1
我想用在连接字符串中的服务器的IP地址连接到服务器:远程连接到SQL Server在C#
这就是我要做的:
SqlConnection conn = new SqlConnection("data source = IPaddress;" + "Trusted_Connection=yes;" + "Initial Catalog = Real Estate;" + "user id = sa" + "password = password;");
conn.Open();
if(conn.State.Equals("Open"))
{
MessageBox.Show("Connected");
}
else
{
MessageBox.Show("Not Connected");
}
为什么这个代码不工作?它总是在例外: conn.Open();
尽管我们功能强大,但是stackoverflow还没有发展出能够阅读您的想法。在我们开始之前,您将不得不发布您所看到的错误消息,作为您的问题的一部分。 –
感谢您纠正我@TomRedfern –