ADO连接sql 2000问题
str_serversIP = "192.168.1.222"
str_DBConnectString = "driver={sql server};server =" & str_serversIP & ";uid=sa;pwd=123456;Database=STX"
Set rs = New ADODB.Recordset
Set conn = New ADODB.Connection
conn.ConnectionString = str_DBConnectString
conn.ConnectionTimeout = 50
conn.Open
Set rs.ActiveConnection = conn
rs.CursorType = adOpenDynamic
Set rs = New ADODB.Recordset
Set conn = New ADODB.Connection conn.ConnectionString= "driver=sqlserver};server=192.168.1.222;uid=sa;pwd=123456;Database=STX"
conn.ConnectionTimeout = 50
conn.Open
Set rs.ActiveConnection = conn
rs.CursorType = adOpenDynamic
str_serversIP = "192.168.1.222" str_DBConnectString = "driver={sql server};server =" & str_serversIP & ";uid=sa;pwd=123456;Database=STX"
'错误是在server和等号之间多了一个空格,去掉空格就没有错误了。
str_serversIP = "192.168.1.222" str_DBConnectString = "driver={sql server};server=" & str_serversIP & ";uid=sa;pwd=123456;Database=STX"