且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C#,SQL Server-连接到本地服务器而不指定数据源

更新时间:2023-02-22 20:50:36

查看MSDN上ConnectionString上的文档,您会找到此信息

Looking at the docs on ConnectionString on MSDN you could find this information


要连接到本地计算机,请为服务器指定(local)。如果未指定
服务器名称,则将尝试连接到本地计算机上的
默认实例。

To connect to a local computer, specify "(local)" for the server. If a server name is not specified, a connection will be attempted to the default instance on the local computer.

http ://msdn.microsoft.com/zh-CN/library/system.data.sqlclient.sqlconnection.connectionstring(v = vs.100).aspx