Public Const ConnectString = "Provider=SQLOLEDB.1; Data Source=HWYANG; User ID=sa; Password=920; Initial Catalog=AccountDataBase "
Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
cnn.Open ConnectString
如上的语句cnn就连接到服务器“HWYANG”上的 AccountDataBase 数据库了