Specifying Connection Properties
You can supply much of the information specified by a connection string by setting properties of the Connection object before opening the connection. For example, you could achieve the same effect as the connection string discussed in Creating a Connection String by using the following code.
With objConn
.Provider = "SQLOLEDB"
.Properties("Data Source") = "MySqlServer"
.Properties("Integrated Security") = "SSPI"
.Open
.DefaultDatabase = "Northwind"
End With
DefaultDatabase is set only after you open the connection.
Note
In ADO you must not use a password containing semicolons (";") unless the password is enclosed in single quotation marks.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for