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

编程入门 行业动态 更新时间:2024-10-26 06:35:41
本文介绍了错误:“在建立con时发生了与网络相关或特定于实例的错误".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨 我正在开发一个VB应用程序..当我尝试连接到数据库时,出现此错误;有很多解决方案,但对我来说效果不佳..有任何想法吗? 建立与SQL Server的连接时发生与网络相关或特定于实例的错误.服务器未找到或无法访问.验证实例名称正确,并且已将SQL Server配置为允许远程连接. (提供者:SQL网络接口,错误:26-指定服务器/实例时出错)

Hi I''m developing a VB application .. and when I try to connect to the databse I get this error; Itry many solution but nothing is working well with me ..Any Idea? 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)

推荐答案

可能是您的连接字符串有问题. 首先,尝试使用服务器资源管理器"窗格在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! :)

更多推荐

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

本文发布于:2023-11-02 13:43:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552549.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   实例   发生了   网络   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!