客户端计算机中的Windows应用程序错 [英] Windows application error in Client Machine

查看:82
本文介绍了客户端计算机中的Windows应用程序错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用C#2.0和SQL Server 2005开发了一个Win Form Application。我还创建了这个应用程序的Setup文件。我在客户端计算机中安装了此应用程序。当我在客户端计算机上运行此应用程序时,它运行时出现以下错误: -



您的应用程序中发生了未处理的异常。如果单击继续,应用程序将忽略此错误并尝试继续。如果单击退出,应用程序将立即关闭。

建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确以及SQL Server是否配置为允许远程连接。(提供程序:命名管道提供程序。错误:40-无法打开与Sql Server的连接。)



我是Window Application的新手,无法找出原因。请有人帮助我。

I developed a Win Form Application by used C#2.0 and SQL Server 2005. I also created a Setup file of this application. I installed this application in the Client Machine. when I run this application on Client Machine it runs with an error given below :-

Unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately.
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: Named Pipes Provider. error:40- Could not open a connection to Sql Server.)

I am very new to Window Application and unable to find out the reason. Please someone help me.

推荐答案

错误信息非常明确!

The error message is pretty explicit!
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.





查看代码,找到连接您用于连接到SQL Server的字符串。如果你硬编码 - 这是一个问题,你需要立即将它移动到配置文件。

当它在配置文件中时,你需要编辑它以反映SQL的路径保存数据库的服务器实例,如新PC所见。可能会将其设置为您的开发计算机实例LOCALHOST \ SQLEXPRESS或类似设置,并启用Windows授权。这需要更改以反映客户端PC将使用的SQL实例,并填写正确的登录详细信息。



Look at your code, and find the connection string you are using to connect to SQL Server. If you hard coded it - that's a problem, and you need to move it to a configuration file immediately.
When it's in a config file, you will need to edit it to reflect the path to the SQL server instance holding your database as seen by the new PC. Probably, it is set to your development machine incstance "LOCALHOST\SQLEXPRESS" or similar, with windows authorization set on. This needs to be changed to reflect the SQL instance that the client PC will be using, complete with the correct login details.


这篇关于客户端计算机中的Windows应用程序错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆