问题描述
- 请各位大神看一下这是错在哪里
- System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces error: 26 - Error Locating Server/Instance Specified)
我想问一下是不是我数据库连接不成功,还是数据库的连接语句有错,谢谢了
解决方案
在vs2008的Tools -> Options -> Data base Tools -> Design Time - Validation Data base -> Connection Options -> SQL Serevr Instance Name 中设置为空就可以。
解决方案二:
检查防火墙、sql server的tcp/ip协议是否启用、是否允许远程连接,等等。
时间: 2024-10-04 18:40:39