I'm sure this has been asked previously and serached the forum with no luck. I'm using vb05-express to connect. I create the db in the folder the program executes from. The connection string is as follows;
Dim myCn As New SqlConnection
myCn.ConnectionString = "Server=.\SQLExpress;Database=TestDb.mdf;" & _
"Integrated Security=True;" & _
"Type System Version=Latest;" & _
"User Instance=True"
myCn.Open()
The error msg is;
Cannot open database "TestDb.mdf" requested by the login. Login failed for "machinename'\default.
Is this an authorization issue?
Appreciate any help you can provide
Hi,
Instead of using
Database=TestDb.mdf
instead use
AttachDbFilename=|DataDirectory|\TestDb.mdf
and the database will be copied and attached to the user instance. See the whitepaper on user instances at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sqlexpuserinst.asp for more details.
Thanks
No comments:
Post a Comment