Public Sub DataEnvironment_Initialize()
If Connection1.State = adStateOpen Then Connection1.Close
Connection1.Properties("Data Source").Value = your_server_name
Connection1.Properties("Initial Catalog").Value = your_database_name
Connection1.Properties("User ID").Value = user_name
Connection1.Properties("Password").Value = password
Connection1.Open
End Sub
where Connection1 is your connection.
Quote:
Originally posted by heidil90
I have a question about Data Environment that I used in a VB utility. Usually when I make a connection object, I set connection string through the property dialog interface in the design time. Now I want to set the connection string dynamically in the run time, for example, the utility can be run both in my local and server, how to do that?
Thanks in advance!
|