VB做登陆界面的代码出现问题
PrivateSubCmdCancel_Click()UnloadMeEndSubPrivateSubCmdOK_Click()DimcheckAsNewADODB.Re...
Private Sub CmdCancel_Click()
Unload Me
End Sub
Private Sub CmdOK_Click()
Dim check As New ADODB.Recordset
Dim DBstr As String
Dim UserID As String
Dim UserPwd As String
If Len(Trim(Me.TextUser.Text)) <= 0 Then
MsgBox "请输入用户名!", , "登录信息"
Exit Sub
End If
If Len(Trim(Me.TextUser.Text)) > 8 Then
MsgBox "您输入用户名过长!", , "登录信息"
Exit Sub
End If
If Len(Trim(Me.TextPwd.Text)) <= 0 Then
MsgBox "请输入密码!", , "登录信息"
Exit Sub
End If
If Len(Trim(Me.TextPwd.Text)) > 8 Then
MsgBox "您输入密码过长!", , "登录信息"
Exit Sub
End If
DBstr = "select * from UserInfo where UserID='" & UserID & "'"
If check.EOF Then
MsgBox "没有该用户!", , "登录信息"
check.Close
Exit Sub
Else
If check.Fields("UserPwd").Value = TextPwd.Text Then
MsgBox "密码正确!", , "登录信息"
Else
MsgBox "密码错误!", , "登录信息"
Exit Sub
End If
End If
Unload Me
frmMain.Show
End Sub
运行时发现有错误,是这样描述的,对象关闭时,不允许操作。
光标在此语句位置 If check.EOF Then
请高手指教 急!!!谢谢 展开
Unload Me
End Sub
Private Sub CmdOK_Click()
Dim check As New ADODB.Recordset
Dim DBstr As String
Dim UserID As String
Dim UserPwd As String
If Len(Trim(Me.TextUser.Text)) <= 0 Then
MsgBox "请输入用户名!", , "登录信息"
Exit Sub
End If
If Len(Trim(Me.TextUser.Text)) > 8 Then
MsgBox "您输入用户名过长!", , "登录信息"
Exit Sub
End If
If Len(Trim(Me.TextPwd.Text)) <= 0 Then
MsgBox "请输入密码!", , "登录信息"
Exit Sub
End If
If Len(Trim(Me.TextPwd.Text)) > 8 Then
MsgBox "您输入密码过长!", , "登录信息"
Exit Sub
End If
DBstr = "select * from UserInfo where UserID='" & UserID & "'"
If check.EOF Then
MsgBox "没有该用户!", , "登录信息"
check.Close
Exit Sub
Else
If check.Fields("UserPwd").Value = TextPwd.Text Then
MsgBox "密码正确!", , "登录信息"
Else
MsgBox "密码错误!", , "登录信息"
Exit Sub
End If
End If
Unload Me
frmMain.Show
End Sub
运行时发现有错误,是这样描述的,对象关闭时,不允许操作。
光标在此语句位置 If check.EOF Then
请高手指教 急!!!谢谢 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询