I am moving from MSDE to SqlServer Express and am having an issue with the connection string for accessing a database. What I am attempting to achieve is a connection string that will work on any local machine so that the application can function as a stand alone app. I realize that this is somewhat antithetical to SqlSever, but nonetheless….
With MSDE, setting the datasource property to (local) - see example below - allows this to happen. When attempting to set the datasource property to ‘local’ - see the second string below - using SqlServer Express, I get an error as follows – “Cannot open database ‘DatabaseName’ requested by the login. The login failed”.
Is there some way around this problem? Thanks in advance.
Connection String w/MSDE
workstation id=(local);packet size=4096;integrated security=SSPI;data source=(local);persist security info=False;initial catalog=DataBaseName
Connection String w/SqlServer Express
Dim strDBConnection As String = "workstation id='local';packet size=4096;" & _
"integrated security=SSPI;data source=local;" & _ "persist security info=False;initial catalog=DataBaseName"
With MSDE, setting the datasource property to (local) - see example below - allows this to happen. When attempting to set the datasource property to ‘local’ - see the second string below - using SqlServer Express, I get an error as follows – “Cannot open database ‘DatabaseName’ requested by the login. The login failed”.
Is there some way around this problem? Thanks in advance.
Connection String w/MSDE
workstation id=(local);packet size=4096;integrated security=SSPI;data source=(local);persist security info=False;initial catalog=DataBaseName
Connection String w/SqlServer Express
Dim strDBConnection As String = "workstation id='local';packet size=4096;" & _
"integrated security=SSPI;data source=local;" & _ "persist security info=False;initial catalog=DataBaseName"