Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法从另一台计算机连接sql server 2008_C#_Winforms_Sql Server 2008_Connection String - Fatal编程技术网

C# 无法从另一台计算机连接sql server 2008

C# 无法从另一台计算机连接sql server 2008,c#,winforms,sql-server-2008,connection-string,C#,Winforms,Sql Server 2008,Connection String,可能重复: 我有一个c#中的winform应用程序,它连接到我自己的数据库,工作正常。我当前的sql连接字符串是: SqlConnection con = new SqlConnection("Data Source=ITPL_PC1;Initial Catalog=Data_Project;Persist Security Info=True;user id=sa;Password=insforia"); 但是当我把这个winform带到另一台计算机上时,它不工作。。然后我将连接字符串更

可能重复:

我有一个c#中的winform应用程序,它连接到我自己的数据库,工作正常。我当前的sql连接字符串是:

SqlConnection con = new SqlConnection("Data Source=ITPL_PC1;Initial Catalog=Data_Project;Persist Security Info=True;user id=sa;Password=insforia"); 
但是当我把这个winform带到另一台计算机上时,它不工作。。然后我将连接字符串更改为:

SqlConnection con = new SqlConnection("Data Source=192.168.0.28\\ITPL_PC1;Initial Catalog=Data_Project;Persist Security Info=True;user id=sa;Password=insforia"); 
但它不起作用

我已经更改了sql server中远程访问的所有设置,但仍然显示错误

Sql Exception was unhandled 
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) 
是我的连接字符串错了吗?应该是什么

请帮帮我

Data Source=ITPL_PC1
标识名为
ITPL\U PC1
的服务器。您正在连接到此服务器上的默认实例

Data Source=192.168.0.28\ITPL_PC1
标识在IP地址为192.168.0.28的服务器上运行的名为
ITPL_PC1
的实例。我们不知道这个服务器的名称

Data Source=192.168.0.28\ITPL_PC1

如果要连接的实例是
ITPL\u PC1
上的默认实例,则第一个版本应始终有效(前提是可以解决
ITPL\u PC1

Windows安全性可能会阻止访问。您可以试试下面的方法。
1.在运行窗口中键入
services.msc
进入windows的服务管理控制台。
2.在显示的窗口中,您可以看到服务列表。从列表中找出
基本筛选引擎

3.右键单击并停止。完成了


经过大量的谷歌搜索,我已经修复了类似的问题。(对我来说,即使从sql configuration manager启用TCP/IP,它也不起作用)

是的,我对防火墙设置进行了更改您是否使用sql Server configuration manager启用了TCP-IP客户端协议?是的,感谢@damien,我解决了它谢谢您。。。。它只是起作用了。。。实际上,
Data Source=192.168.0.28\ITPL\u PC1
我是通过谷歌搜索找到的,所以我使用了它,但谢谢