Dim connstr
connstr = "Provider=SQLOLEDB.1;Persist Security Info=False;Initial Catalog=CC_JZX_WINC_13_03_06_10_00_07R;Data Source=.WINCC;uid=sa;pwd=;"
Set MyConn = CreateObject("ADODB.Connection")
With MyConn
.ConnectionString = connstr
.CursorLocation = 3
.Open
End With
Dim strSQL
Dim rsTmp
strSQL = "数据库操作语句"
Set rsTmp = CreateObject("ADODB.Recordset")
Set rsTmp.ActiveConnection = MyConn
With rsTmp
.CursorLocation = 3
.CursorType = 3
.LockType = 1
.Source = strSQL
.Open
End With
刚学着弄完,Persist Security Info=False;这条语句害我研究了很久,之前没有太在意,导致远程读取时登录失败