Skip to content Skip to sidebar Skip to footer

I Cannot Connect To Sql Server Express Using Vb.net

Can someone tell me what I am missing? I am using this connection string to connect to my database and still it won't connect: Dim str As String = 'Provider = .NET Framework Data P

Solution 1:

Can you post the error? I've never seen the Data Source connected to a .mdf, only with "AttachDbFilename", you might want to take a look here for details on Connection strings for SQL.

Solution 2:

Most likely, you'll need something like this:

Dim str AsString = "Server=.\SQLExpress;AttachDbFilename=C:\Users\konin\Documents\UHMS\bin\Debug\UHMS.mdf;Database=dbname; Trusted_Connection=Yes;"

You'll still need to have SQL Server Express installed on your machine in order to load this *.mdf file.

Solution 3:

Assuming yours is a web application... you need to place your file based database in the App_Data folder of your project for it to work. I noticed is located in the Debug folder...

Post a Comment for "I Cannot Connect To Sql Server Express Using Vb.net"