C#Windows应用程序+ SQL Server 2005 Express [英] C# Windows Application + SQL Server 2005 express

查看:95
本文介绍了C#Windows应用程序+ SQL Server 2005 Express的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

首先,对不起,如果我在错误的地方打开我的学科.

让我简短地解释一下我的故事.

我使用VS 2008 C#和SQL Server 2005开发了Windows应用程序.我将应用程序安装在测试环境中. 安装.但是,当我尝试运行程序时,出现以下错误:

建立与服务器的连接时发生错误.连接到SQL Server 2005时,此失败可能是由于以下事实导致的:在默认设置下,SQL Server不允许远程连接.(提供程序:SQL网络接口,错误: 26-错误定位指定的服务器/实例)"

我的测试环境规格为:

-Windows XP SP2
-NET Framework 3.5
-SQL Server 2005 Express

我的部署程序包具有Windows Intaller 3.1,NET Framework 3.5,SQL Server 2005 Express sp2和我的应用程序.

为了在测试机上测试我的SQL Server 2005 Express,我安装了SSMS Express.我可以访问它的名称为SQL_Express的sql实例.也可以使用SSMS Express来执行数据库操作.

但是,当我尝试运行我的应用程序时,我在上面遇到了这个错误. :(

有人可以帮我吗?

谢谢大家.

Kerem

Hi everybody,

Firstly, excuse me if I opened my subject in wrong place.

And let me explain my story in a short way.

I developed a Windows application with VS 2008 C# and SQL Server 2005. I installed my application on test environment.There was no error when
installing.But,when I try to run my program, it gave me the error below:

"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"

My test environment specifications are:

- Windows XP SP2
- NET Framework 3.5
- SQL server 2005 express

My deployment package has Windows Intaller 3.1, NET framework 3.5, SQL server 2005 express sp2, and my application.

In order to test my SQL server 2005 express on test machine, I installed SSMS Express. I can reach my sql instance as its name is SQL_Express.And I can do my database actions by using SSMS Express.

But,when I tried to run my application, I take this error above. :(

Can someone help me please?

Thanks of all.

Kerem

推荐答案

也许您的ConectionString错误,请在连接字符串中使用.\ SQLEXPRESS"或"localhost \ SQLEXPRESS".(在app.confog文件中)
Perhaps your ConectionString is wrong , use ".\SQLEXPRESS" or "localhost\SQLEXPRESS" in your connection string.(in app.confog file)


如果您使用的是ODBC设置,请检查这些设置是否已正确配置.
If you are using ODBC settings, check that these have been configured properly.


要检查的几件事:
-是SQL Server在远程客户端上侦听(允许远程连接).您可以在服务器端使用配置实用程序进行检查
-您是否安装了命名实例.如果是,请在连接字符串中包含实例名称吗?
-客户端和服务器之间的防火墙?是否已正确配置以允许流量.
Few things to check:
- is the SQL Server listening on remote clients (remote connections allowed). You can use the configuration utility on the server side to check this
- Did you install named instance. If yes, do you include the instance name in your connection string
- Firewall between client and server? Is it configured correctly to allow traffic.


这篇关于C#Windows应用程序+ SQL Server 2005 Express的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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