如何实现密码登陆

来源:百度知道 编辑:UC知道 时间:2024/06/03 13:54:20
If Len(Text1.Text) = 0 Then
MsgBox "请输入您的用户名。", vbInformation, "系统提示"
Text1.SetFocus
Text1.Text = ""
Exit Sub
ElseIf Len(Text2.Text) = 0 Then
MsgBox "请输入您的密码。", vbInformation, "系统提示"
Text2.SetFocus
Exit Sub
End If
Adodc1.RecordSource = "select * from yh where yonghu = '" + Text1.Text + "'"
Adodc1.Recordset.Requery
If Not Adodc1.Recordset.EOF Then
If Text1.Text <> "" And Text2.Text <> "" And Text2.Text = Adodc1.Recordset.Fields("mima") Then
Unload Me
addate.Show 'If Text1.Text = Adodc1.Recordset("yonghu").Value And Text2.Text = Adodc1.Recordset.Fields("mima") Then
Else
MsgBox "用户名或密码错误", vbInformation, "系统提示"

Private Sub Command1_Click()
Adodc1.Refresh
For i = 1 To Adodc1.Recordset.RecordCount
If Text1 = "" Then
MsgBox "请输入用户名"
Exit Sub
End If

If Text1 = Adodc1.Recordset.Fields(0).Value Then
If Text2 = Adodc1.Recordset.Fields(1).Value Then
Unload Form1
Form2.Show
Exit Sub
Else
MsgBox "密码有误"
Exit Sub
End If
End If
Adodc1.Recordset.MoveNext
Next i

MsgBox "用户不存在"
End Sub