With conn
If .State = adStateOpen Then
.Close
End If
.CursorLocation = adUseClient
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & strSQL
.Open
End With
With rs
.Open "Select * from Authors;", conn, adOpenStatic, adLockOptimistic
If .BOF And .EOF Then
msgbox "没有任何记录"
Exit Sub
End If
.MoveFirst
.movelast
msgbox "有" & .recordcount & "条记录!"
N = .recordcount
End With
dim conn as ADODB.Connection
dim rs as ADODB.Recordset
set conn = new adodb.connection
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DataBasePath\DATABASEName.mdb;Persist Security Info=False"
set rs=new adodb.recordset
rs.open "Select * from 表名",conn,adOpenDynamic,adLockOptimistic
With conn
If .State = adStateOpen Then
.Close
End If
.CursorLocation = adUseClient
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & strSQL
.Open
End With
With rs
.Open "Select * from Authors;", conn, adOpenStatic, adLockOptimistic
If .BOF And .EOF Then
msgbox "没有任何记录"
Exit Sub
End If
.MoveFirst
.movelast
msgbox "有" & .recordcount & "条记录!"
N = .recordcount
End With