16,552
社区成员
发帖
与我相关
我的任务
分享
Private Sub cmdOK_Click()
Dim txtSQL As String
Dim rstLogin As ADODB.Recordset
Dim flag As String
gUserName = ""
gUserKind = ""
If Trim(txtUserName.Text = "") Then
MsgBox "用户名不能为空!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
txtSQL = "select * from tbUser where UserId = '" & txtUserName.Text & "'"
flag = ExecuteSQL(txtSQL, rstLogin, False)
If rstLogin.EOF = True Then
MsgBox "没有这个用户,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
If Trim(rstLogin.Fields(1)) = Trim(txtPassword.Text) Then
gUserName = Trim(txtUserName.Text)
gUserKind = Trim(rstLogin.Fields(2))
gLoginSucceeded = True
rstLogin.Close
Me.Hide
frmMain.Show
Else
MsgBox "密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtPassword.SetFocus
txtPassword.Text = ""
End If
End If
End If
miCount = miCount + 1
If miCount = 3 Then
Me.Hide
Exit Sub
End If
End Sub