添加 TableAdapter 导致我无法打开连接

发布于 2025-01-04 06:56:13 字数 665 浏览 0 评论 0原文

我尝试在 Visual Studio 中创建 TableAdapter,我通过了向导的所有步骤,当我结束时,它尝试创建 TableAdapter 并给我一个错误。这是我第一次尝试创建 TableAdapter,所以我可能会错过一些非常明显的东西。

我的设置

  • Visual Studio 2010
  • 我的实例位于 \\VMDEVCIAQ\NMPUTIL
  • 我的连接字符串是 Provider=SQLNCLI10;Data Source=VMDEVCIAQ\NMPUTIL;Persist Security Info=True;Password=Secret;User ID=Secret;Initial Catalog=NMPUTIL

错误消息

“无法打开数据库连接,错误 26 错误定位指定的服务器/实例”

我尝试过

- portqry.exe -n VMDEVCIAQ -p UDP -e 1434 

,它给了我肯定的答案。所以这不是防火墙问题或 SQL Browser 服务未运行。

我知道连接字符串有效,因为在连接向导中它表示连接成功。

知道为什么视觉工作室对我很刻薄吗?

干杯

I try to create a TableAdapter in visual studio, I pass all steps of the wizard and when I end, it tries to create the TableAdapter and give me an error. It's my first time trying to create a TableAdapter so I may miss something really obvious.

My setup

  • Visual Studio 2010
  • My instance is on \\VMDEVCIAQ\NMPUTIL
  • My connection string is Provider=SQLNCLI10;Data Source=VMDEVCIAQ\NMPUTIL;Persist Security Info=True;Password=Secret;User ID=Secret;Initial Catalog=NMPUTIL

Error message

"Failed to open a connexion to the database, error 26 error locating the server/instance specified"

What I tried

- portqry.exe -n VMDEVCIAQ -p UDP -e 1434 

and it gave me a positive answer. So it's not a firewall problem or SQL Browser service not running.

I know the connection string work since in the connection wizard it says connection successful.

Any idea why visual studio is being mean to me ?

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

独﹏钓一江月 2025-01-11 06:56:13

为了解决这个问题,我最终重新创建了数据集(XSD 文件)。我使用数据集设计器界面将对象从损坏的数据集中复制到新数据集中,一切顺利。

To fix this problem, I ended up recreating the dataset (XSD file). I copied the objects from the broken dataset to the new one, using the dataset designer interface and all was well.

旧时浪漫 2025-01-11 06:56:13

看到您正在使用“命名实例”连接到 SQL Server,请务必检查 SQL Browser 服务是否正在同一实例上运行([Start] ->“services.msc”) SQL Server 所在的计算机。

还要确保服务器具有 SQLBrowser 可执行文件并且 UDP 端口 1434 已打开 - 防火墙通常可能会阻止访问。

最后,使用 Visual Studio 重新配置项目设置中找到的连接字符串。例如,我从使用用户名和密码的 SQL Server 身份验证移至“默认实例”,然后测试连接,并保存我的连接字符串。

还要确保 DataSet/TableAdapter 属性中的连接字符串正确。因为这将使上述所有内容变得毫无用处。该字符串是 Visual Studio 尝试连接的连接字符串。

由于缓存的原因,对连接字符串进行任何更改后,请重新启动 Visual Studio。我无法告诉您上述哪一项(如果有的话)可以解决此问题。但我可以向您保证,解决问题后需要重新启动 Visual Studio,即使使用 VS2013 也是如此。

Seeing that you are using a "Named Instance" to connect to SQL Server, be sure to check if the SQL Browser service is running ([Start] -> "services.msc") on the same computer that the SQL Server is on.

Also make sure the server has both the SQLBrowser executable and that the UDP Port 1434 is open - a firewall often may be blocking access.

Finally, use Visual Studio to reconfigure the connection string found in the project settings. I, for instance, moved away from the SQL Server Authentication with username and password to the "Default Instance" then tested the connection, and saved my connection string.

Also ensure the connection string is correct in the DataSet/TableAdapter properties. As that would render all the above useless. It is that string that is the connection string Visual Studio is trying to connect to.

Because of caching, after any changes to the connection string, restart Visual Studio. I can't tell you which of the above (if any at all) is the fix to this problem. But I can assure you that after you do fix the problem restarting Visual Studio is needed, even with VS2013.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文