Dashsa
Dashsa

Reputation: 718

ASP.NET connection to local DB not working

I am trying to connect to a local SQL Server database and It is not working, the connection String is

Dim connString As String = "server=C:\Program Files (x86)\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA;Integrated Security=SSPI;initial catalog=AdventureWorks"
sqlConn.ConnectionString = connString
sqlConn.Open()

Upvotes: 1

Views: 360

Answers (2)

Oded
Oded

Reputation: 499002

The server parameter looks mighty fishy to me.

If this is a SQL Server instance, you are trying to connect to the data file, not the database. It should be the network name of the computer that SQL Server is installed on.

I suggest taking a look at connectionstrings.com to see how it should look like.

Upvotes: 4

C0L.PAN1C
C0L.PAN1C

Reputation: 12243

Server has to be a server name. If it's on the same box do localhost in lieu of that long funky path.

Upvotes: 2

Related Questions