Im trying to use concatenation to make a connection string. Heres the code:
objMyConn.ConnectionString = "Provider=SQLOLEDB;Initial Catalog=MyCat;Data Source=" & serverName & ";User ID=MyId;Password=MyPwd;"
serverName is a string defined like this: serverName = "ServerName\InstaceName"
I am expecting for objMyConn.Connection string to be = to the whole connection staring however it is = to this:
Provider=SQLOLEDB;Initial Catalog=MyCat;Data Source=ServerName\InstanceName
So I'm missing the last part of my connection string.
serverName = "ServerName\\InstanceName"?'in your connection string, soobjMyConn.ConnectionString = "Provider='SQLOLEDB';Initial Catalog='MyCat';Data Source='" & serverName & "';User ID='MyId';Password='MyPwd';"