我只想知道远程sql server express版本的正确sql连接字符串。适用于C#的远程SQL服务器的正确连接字符串
这是我得到了,但我得到了一些问题
SqlConnection cs = new SqlConnection(@"Data Source=(IP Address)\PC-NAME\SQLEXPRESS,1433;Network Library=DBMSSOCN;Initial Catalog=dbase;User ID=sa;Password=password");
我在C#中的调试器得到这个错误:事先
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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
谢谢!
请记住,如果我问192.168.0.100 IP地址发生了什么?我在连接字符串中看不到。谢谢 – Danny
@Danny实际的服务器地址需要在调制解调器/路由器的端口转发中设置。连接字符串告诉SQL客户端连接到调制解调器,该调制解调器然后将连接转发到内部服务器。从客户的角度来看,服务器位于公共地址,而不是私人地址。 – Corey
@Corey如果我连接到安装了SQL Server的Azure中的虚拟机,并且允许远程访问,该怎么办?在这种情况下,我可以把IP地址如果虚拟机在数据源? –