You are very close to doing exactly what I do. I have a dummy remote view that I open instead after setting the connect string with the user ID and password. This dummy view has a shared connection, and I open it in a private data session using the VFP 6 SP3 session class. This way the view is protected from the default datasession and not destroyed until the app is closed.
I them use store the connection handle to my oApp object:
oApp.ConnectionHandle = CursorGetProp("ConnectHandle", "v_OracleConnection")
Now, I can use this shared connection for all other remote views or for SPT.
>Hi!
>
>Is it possible to open a connection using SQLStringConnect() and have VFP use that connection for remote views?
>
>The reason is that I would like to be able to ask for username/password when the application starts. Of course, using SQLConnect I can do that, but I'd rather not set up a DSN in the control panel; I prefer letting my application set up itself all the connection parameters.
>
>Right now what I do is that I ask for parameters, use DBSETPROP() to save the new connection string to the connection in the database, and re-issue as DBSETPROP() at the end of the program to remove the password from the connection string. This way, someone opening the database outside of the application won't be able to see what the password is. Of course, that password is available if the application is running. In addition, should I want to share the DBC for multiple users, that method is no longer an option.
>
>Thanks!
Mark McCasland
Midlothian, TX USA