vb 登陆后说没有这个用户

来源:百度知道 编辑:UC知道 时间:2024/05/27 20:24:39
补充问题说明:我的登录代码是:Option Explicit
Public ok As Boolean
Dim micount As Integer
Private Sub cmdCancel_Click()
ok = False
Me.Hide
End Sub

Private Sub cmdOK_Click()
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
'ToDo: create test for correct password
'check for correct password

txtUserName = ""
If Trim(txtUserName.Text = "") Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
txtSQL = "select * from user_Info where UserID = '" & txtUserName.Text & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else

txtUserName = ""
If Trim(txtUserName.Text = "") Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"

看这里,txtUserName = ""其实就是txtUserName.Text = "" ,故if的条件肯定为真,所以会提示没有这个用户。