也可以用ADO对象.在菜单“工程”—“引用”里,找到Microsoft ActiveX Data Objects 2.7 Library,选中,"确定",然后写代码.
Dim con as
ADODB.Connection
set con =New ADODB.Connection
con.ConnectionString =
_
"driver={sql server};server=localhost;uid=sa;pwd=;database=database_name"
con.Open
'上面连的是本机