-
How do you set the Data Environment's DSN at runtime?
The reason I wish to do this is because the DSN will change depending on a condition.
We set the ConnectionString property at runtime but when a command was executed, a dialog box pops-up prompting for the selection of a DSN.
-
Do you have some sample code. I do not use a dsn. Is this an option for you? I build the connection string and store the test servername nad the production server name in a variable. Depending which server was selected move the appropriate server.
Code:
m_strConnectString = "Provider=MSDASQL.1;" _
& "Persist Security Info=False;" _
& "Driver={SQL Server};" _
& "Server=" & iif(bTestserver,strTestServerAddress,strProdServerAddress) & ";" _
& "database=AG1DB01;" _
& "User ID=" & m_strUserID & ";" _
& "Password=" & m_strPassword & ";"