关于用VB做的登录界面的问题,VB高手请进

来源:百度知道 编辑:UC知道 时间:2024/06/19 22:25:42
这是我在做学生管理系统时,代码出现了问题,请高手帮我看看,帮我改改,谢谢
Private Sub cmdOK_Click()
Dim sql As String
sql = "select userpassword from use where username='" & txtUserName & "'"

If txtUserName.Text = "" Then
MsgBox "请填写用户名!", vbOKOnly + vbInformation, "注意"
txtUserName.SetFocus
Exit Sub
ElseIf txtPassword.Text = "" Then
MsgBox "请填写密码!", vbOKOnly + vbInformation, "注意"
txtPassword.SetFocus
Exit Sub
End If
Adodc1.RecordSource = sql
Adodc1.Refresh
If Not Adodc1.Recordset.EOF Then
If Adodc1.Recordset!UserName <> txtUserName Then
MsgBox "用户名错误!"
txtUserName.SetFocus
txtUserName = ""
End If
Else
If Adodc1.Recordset!userpassword <> txtPassword Then
MsgBox "密码错误!"
txtPass

Private Sub cmdOK_Click()
Dim sql As String
sql = "select userpassword from use where username='" & txtUserName & "'"

If txtUserName.Text = "" Then
MsgBox , vbOKOnly + vbInformation,
txtUserName.SetFocus
Exit Sub
ElseIf txtPassword.Text = "" Then
MsgBox , vbOKOnly + vbInformation,
txtPassword.SetFocus
Exit Sub
End If
Adodc1.RecordSource = sql
Adodc1.Refresh
If Not Adodc1.Recordset.EOF Then
If Adodc1.Recordset!UserName <> txtUserName Then
MsgBox
txtUserName.SetFocus
txtUserName = ""
End If
Else
If Adodc1.Recordset!userpassword <> txtPassword Then
MsgBox
txtPassword.SetFocus
txtPassword = ""
Else
MDIForm1.Show
Unload Me
End If

End If

End Sub