先有个数据库。
ado,熟吧
简单点:
Dim res As New ADODB.Recordset
res.Open strSql,db '(db明白吧, strSql是你要求的sql的语句)
If res.EOF Then
Static intTryTimes As Long
If intTryTimes = 3 Then
MsgBox "你试得太多!"
LoginSucceeded = False
intTryTimes = 0
Me.Hide
GoTo ExitSub
Else
intTryTimes = intTryTimes + 1
MsgBox "登陆失败!"
GoTo ExitSub
End If
else
LoginSucceeded = True
hide
end if
ExitSub:
On Error Resume Next
res.Close
Set res = Nothing
On Error GoTo 0
Form1.Show
End Sub