Welcome, Guest
Username: Password: Remember me
This public forum is meant for questions and discussions about Visual FoxPro
  • Page:
  • 1

TOPIC:

Remote views, VFP database container (.dbc) and database connections 25 Feb 2021 04:42 #17560

  • RajNZ
  • RajNZ's Avatar
  • Topic Author


  • Posts: 5
  • Hi,

    Sorry if this is answered elsewhere, but I haven't found a document covering this area.

    An important part of making X# feasible for converting our large VFP project is support for :
    Remote views
    VFP database container (.dbc) to hold the remote views (or some alternative)
    Database connections, defined in the .dbc to hold the connection string etc that the views are based on (or some alternative)

    For example :
    open database xyz
    set database to xyz
    create connection myconn ... connstring "Driver=SQL Server;Server= etc" ...
    create sql view myview remote connection myconn as select * from mytable
    use myview
    ...do stuff with myview, including writing with row and table buffering...
    use in myview

    Would also be great if tableupdate() and tablerevert() are supported, but even just immediate writes might be fine.

    While it would be possible to use SQLStringConnect() and sqlexec() instead of remote views, that would involve a great deal of re-coding in VFP and would make an X# conversion impractical at that point.

    Could someone please point me to a document that might cover this, or an entry in the roadmap that either includes or excludes support for these concepts?

    Thanks.
    Paul

    Please Log in or Create an account to join the conversation.

    Remote views, VFP database container (.dbc) and database connections 25 Feb 2021 07:30 #17561

    • robert
    • robert's Avatar


  • Posts: 3289
  • Paul,
    This is indeed not supported yet.
    Can you create a small example against the Sql Server Northwind database that shows how you are using this ?

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    Remote views, VFP database container (.dbc) and database connections 25 Feb 2021 23:04 #17567

    • RajNZ
    • RajNZ's Avatar
    • Topic Author


  • Posts: 5
  • Hi,

    A simple example would be this :
    *** It is assumed that the Northwind VFP database has already been created.
    *** The following 2 lines would be executed once near the start of the application.
    open database Northwind
    set database to Northwind
    *** The following 2 lines would be executed as needed, whenever changing between back-end databases.
    create connection myconn  connstring "Driver=SQL Server;Server= etc..."
    create sql view OrdersView remote connection myconn as select * from Orders where OrderID = ?InputOrderID
    
    *** Fetch the details for order 10248 into a cursor with an alias of CurrentOrder.
    local InputOrderID
    InputOrderID = "10248"
    use OrdersView in 0 alias CurrentOrder
    *** Update the shipping address.
    replace CurrentOrder.ShipAddress with "my new address" in CurrentOrder
    *** Could execute a TableUpdate() now to explicitly commit the data, or simply rely on the automatic commit whenever the row is navigated away from or the cursor is closed.
    use in CurrentOrder

    Please Log in or Create an account to join the conversation.

    Remote views, VFP database container (.dbc) and database connections 26 Feb 2021 09:31 #17568

    • robert
    • robert's Avatar


  • Posts: 3289
  • Paul,
    Thanks for the example.
    I tried this here and the update was not sent to the server.

    I checked the FoxPro docs, and after adding DBSETPROP("OrdersView","VIEW","SendUpdates",.t.) then indeed the changes were sent back to the server.

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1