且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误:“在建立con时发生了与网络相关或特定于实例的错误".

更新时间:2023-02-03 08:20:52

可能是您的连接字符串有问题.
首先,尝试使用服务器资源管理器"窗格在VS中建立连接:
1)打开服务器资源管理器.
2)右键单击数据连接",然后选择添加连接"
3)在随后的对话框中,选择您的数据源和数据库,指定安全信息,然后按测试连接"按钮.
4)连接正常后,按确定"
5)在服务器资源管理器"窗格中突出显示您的数据库,然后查看属性"窗格.将显示一个连接字符串的工作示例,您可以将其复制并粘贴到您的应用程序或配置文件中.

您的连接现在应该可以正常工作.
Probably, you have a problem with your connection string.
First off, try setting up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file.

Your connection should now work.


您尚未创建SQL Server实例(管理工作室),请先完成安装,然后再进行连接.正在与数据库建立联系?您可以发布您的代码吗,所以我可以给您确切的想法.:-)
You havn''t created a instance of SQL server (management studio),first complete your installation and then go for connection .if its their then, how you are making connection with Database ?can u post your code.so i can give you exact idea.:-)


按照solution-2中的讨论,
连接字符串错误.

sql连接字符串应如下所示,

如果sql server具有 Windows身份验证模式
as per discussion in solution-2,
connection string is wrong.

sql connection string should be like below,

if sql server have Windows authentication Mode
"data source=ServerName; Initial Catalog=DatabaseName; Integrated security=true;"



如果sql server具有 SQL身份验证模式



if sql server have SQL authentication Mode

"data source=ServerName; Initial Catalog=DatabaseName; Uid=SQLServerLoginId;pwd=SQLServerPassword;"



祝您编码愉快!
:)



Happy Coding!
:)