简体   繁体   中英

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()

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM