dim adoConnection As New ADODB.Connection dim adoRS As New ADODB.RecordsetWith adoConnection .ConnectionString = "DSN=MS Access 97 Database;DBQ=" & DATABASE & ";DefaultDir=" & App.Path & ";DriverId=281;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;PWD='123'" .Open End WithWith adoRS .ActiveConnection = adoConnection .Source = "select user from table where id='11'" .LockType = adLockReadOnly .Open End With sUser = adoRS!user
Dim conn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim password As Stringconn.connectionstring = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\teacher.mdb;Persist Security Info=False" conn.Open sql = select user from table where id=1" rs.Open sql, conn, 3, 4 if not rs.eof then user = rs("user").Value else msgbox "密码错误" end if conn.Close
dim adoRS As New ADODB.RecordsetWith adoConnection
.ConnectionString = "DSN=MS Access 97 Database;DBQ=" & DATABASE & ";DefaultDir=" & App.Path & ";DriverId=281;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;PWD='123'"
.Open
End WithWith adoRS
.ActiveConnection = adoConnection
.Source = "select user from table where id='11'"
.LockType = adLockReadOnly
.Open
End With
sUser = adoRS!user
Dim rs As New ADODB.Recordset
Dim password As Stringconn.connectionstring = "
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\teacher.mdb;Persist Security Info=False"
conn.Open
sql = select user from table where id=1"
rs.Open sql, conn, 3, 4
if not rs.eof then
user = rs("user").Value
else
msgbox "密码错误"
end if
conn.Close