简体   繁体   English

如何使用远程桌面连接到SQL Server

[英]How do I connect to SQL Server using Remote Desktop

I am trying to connect to a SQL Server Express on a remote PC using a C# application. 我正在尝试使用C#应用程序连接到远程PC上的SQL Server Express。 When I run the application on my local PC to a local server, it works without any issues. 当我在本地PC上将应用程序运行到本地服务器时,它可以正常工作。 When I use Remote Desktop to connect to a client PC, and run the app (I changed the connection string to the local server address), I get an error: 当我使用远程桌面连接到客户端PC并运行应用程序(将连接字符串更改为本地服务器地址)时,出现错误消息:

Error 26: error locating server/instance specified** 错误26:指定服务器/实例时发生错误定位**

Could the issue be in my connection string? 问题可能出在我的连接字符串中吗?

I have tried multiple changes to my connection string (see code below) and even tried the whole UDP connection 1433 TCP/IP port change. 我尝试对连接字符串进行多次更改(请参见下面的代码),甚至尝试更改整个UDP连接1433 TCP / IP端口。

SqlConnection sqlcon = new SqlConnection(@"Data Source=1FEPINMA02\SQLEXPRESS; Initial Catalog=Indigo; User Id=IndigoUser; Password=IndigoUser ;User Instance=False;");

//SqlConnection sqlcon = new SqlConnection(@"Data Source=DAVIDBRITS\SQLEXPRESS;Initial Catalog=Indigo;Integrated Security=True "); // <---------- This is commented out because we tried this also.
sqlconstringx = "Data Source=ipaddress;Initial Catalog=MyDatabase; User ID=MyUsername;password=MyPassword;";

please try. 请试试。

make sure you can ping the server 确保您可以ping服务器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM