SQL Server- Dim StrDBConn1
- StrDBConn1 = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=user123;Password=pwd123;Initial Catalog=MyDB;Data Source=SqlServer-Name"
- Set objRS1 = CreateObject("ADODB.RecordSet")
- Set objsConn1 = CreateObject("ADODB.Connection")
- strSQL1 = "Select * from User where name='" & CName & "'"
- objsConn1.ConnectionString = StrDBConn1
- objsConn1.Open
- objRS1.Open strSQL1, objsConn1, 3, 3
- If objRS1.RecordCount > 0 Then
复制代码 Access- Set conn = CreateObject("adodb.connection")
- Set rs = CreateObject("ADODB.Recordset")
-
- strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
- "Data Source=D:\TEST.MDB;" & _
- "Password=Abcd123;" & _
- "User ID=datamaintain;"
- strSql = "select * from `Users`"
-
- conn.Open strConn
- With rs
- .ActiveConnection = conn
- .CursorLocation = adUseClient
- .CursorType = adOpenKeyset
- .LockType = adLockOptimistic
- .Open strSql
- End With
复制代码
|