[英]SQL Server 2012 connection issues in Visual Studio 2012 Server Explorer
I am trying to connect to SQL Server 2012 installed on Windows Server 2012 through Visual Studio 2012 but keep getting an error 25 connection string is not valid message when trying to connect through server explorer. 我正在尝试通过Visual Studio 2012连接到Windows Server 2012上安装的SQL Server 2012,但在尝试通过服务器资源管理器进行连接时,始终收到错误25连接字符串无效消息。
As far as I am aware it is sharing the same IP address as the main server. 据我所知,它与主服务器共享相同的IP地址。 I am not connected to the domain but have checked that remote connections are enabled and port 1433. I can also connect to the main server.
我没有连接到域,但是已经检查了是否启用了远程连接和端口1433。我还可以连接到主服务器。
I am new to SQL Server so any advice is greatly appreciated. 我是SQL Server的新手,因此非常感谢您提供任何建议。 Thanks
谢谢
You must have the correct connection string. 您必须具有正确的连接字符串。 I show the codes in C# :
我在C#中显示代码:
string con = @"Data Source=.\SQLEXPRESS;AttachDbFilename='c:\users\pc\documents\visual studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Database1.mdf';Integrated Security=True;User Instance=True";
SqlConnection concect = new SqlConnection(con);
The data connection string is located in yourdatabase.mdf
file in connection string. 数据连接字符串位于连接字符串的
yourdatabase.mdf
文件中。 you will see that in visual studio. 您将在Visual Studio中看到它。
Update : 更新:
in server explorer right click on dataconnections then choose add connection. 在服务器资源管理器中,右键单击“数据连接”,然后选择“添加连接”。 then select Microsoft SQL Server in server name use "."
然后在服务器名称中选择Microsoft SQL Server,使用“。” for your server name.
为您的服务器名称。 then you can select your database or you can attach your database file.
那么您可以选择数据库或附加数据库文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.