Alejandro
I did this some months ago:
Build and Launch a Connection Screen to capture Server, Database, etc.
Build your connection string by code and store it to a variable like m.gcConn
m.gcConn = "Driver=SQL Server" + ;
";Server=" + allt(m.gcServer) + ;
";Database=" + m.gcBase + ;
";UID=" + allt(Thisform.txtcUID.Value) + ;
";PWD=" + allt(Thisform.txtcPWD.Value)
Since you said you have a unique connection, then set this property:
OPEN DATABASE YourDBC
SET DATABASE TO YourDBC
DBSETPROP('YourConnection','connection','ConnectString', m.gcConn)
With this approach, your remote views in the form's dataenvironment will work without changes.
>We have a dbc that has a single named connection and several remote views and life has been good.
>
>We now wish to give the option to connect to any of several servers that have identically named databases with the same structure as the original one. We tried SQLSTRINGCONNECT() with the appropriate connection string to the second server but data keeps coming from the original server.
>
>Whan can be the problem?
>
>Than you very much.
>
>Alex