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

posted @ 2008-11-13 20:37  千年  阅读(3413)  评论(1编辑  收藏  举报