I am trying to connect to a sql server using login which accepts the username and password, instead of storing the credentials in the connection string.
But whenevr I pass the variable in the connection string I am getting an error which says login failed for the user. Is it possible to pass variables in the connection string?
The connection string is:
strSQLconn = "Driver={SQL Server};Server=Servername;Database=dbname;" & _
"Uid=username;Pwd=& strPw;"
objSQLconn.Open strSQLconn
strPw is the variable in which I am storing the password.
It works fine when I do it without the login form.
Can anyone tell me why this error is showing up?