SQL Server 2008连接字符串

以VBScript为例,不作复杂的解释:
Set Conn = CreateObject("ADODB.Connection")

本地连接:

Conn.Open("Driver={SQL Server};Server=.\SQLEXPRESS;Database=SJTU;Uid=kissrat;Pwd=kissratpass;")

或者

Conn.Open("Driver={SQL Server};Server=(local)\SQLEXPRESS;Database=SJTU;Uid=kissrat;Pwd=kissratpass;")

通过IP的连接:

必须启用TCP/IP协议和Sql Server Browser服务,并重启Sql Server :

Conn.Open("Driver={SQL Server};Server=127.0.0.1\SQLEXPRESS;Database=SJTU;Uid=kissrat;Pwd=kissratpass;")

Conn.Open("Driver={SQL Server};Server=192.168.0.1\SQLEXPRESS;Database=SJTU;Uid=kissrat;Pwd=kissratpass;")

必要时启用Named Pipes协议。

参考资料:

http://www.connectionstrings.com/?carrier=sqlserver2008

http://www.cnblogs.com/laoxu/archive/2006/08/30/490122.aspx

转载于:https://www.cnblogs.com/kissrat/archive/2008/11/13/1333082.html

你可能感兴趣的:(数据库,网络)