Dim the db As New ADODB. Connection
Dim the rs As New ADODB. You
Dim strSQL As String
Private Sub Command1_Click ()
The ConnectionString="Provider=Microsoft. Jet. The OLEDB. 4.0; Data Source=C: \ Documents and Settings \ as long as the current state of the instance \ \ desktop \ VBA self-study system \ status management. MDB. Persist Security Info=False "
The Open
If Combo1. Text="Or" Text1="" Then
MsgBox "sorry, input account or password cannot be empty." , 16, "login failed!"
The Exit Sub
End the If
If Combo1. Text & lt;> "" And Text1 & lt;> "" Then
StrSQL="select * from login account information Where name='" & amp; Combo1. Text & amp; "' and password='" & amp; Text1. Text & amp; "'
"End the If
Rs. The Open strSQL, db, 3, 1
If the Trim (rs) Fields (" login name "))=Trim (Combo1. Text) And Trim (rs) Fields (" password "))=Trim (Text1. Text) Then
MsgBox "login successful!" , "congratulations!"
Addxk. Show
Unload Me
The Else
MsgBox "sorry, no this user, please enter again!" , 16, "login failed!"
Combo1. Text=""
Text1. Text=""
Combo1. SetFocus
End the If
Rs. Close
The Close
End Sub
CodePudding user response:
You write as if no problem