关于VB数据库的一个问题 能从下面代码看出登陆用户名和密码是多少吗?
PrivateSubcmdCancel_Click()txtUserName=""txtPwd=""txtUserName.SetFocusEndEndSubPrivat...
Private Sub cmdCancel_Click()
txtUserName = ""
txtPwd = ""
txtUserName.SetFocus
End
End Sub
Private Sub cmdOk_Click()
If txtUserName = "" Then
MsgBox "请输入用户名", , "登录"
txtUserName.SetFocus
Exit Sub
End If
If txtPwd = "" Then
MsgBox "请输入密码", , "登录"
txtPwd.SetFocus
Exit Sub
End If
adoUser.RecordSource = "SELECT * FROM Users WHERE Username='" & Trim(txtUserName) & "'"
adoUser.Refresh
If adoUser.Recordset.EOF = True Then
MsgBox "用户名不存在", , "登录"
TryTimes = TryTimes + 1
If TryTimes >= 3 Then
MsgBox "已经三次尝试进入本系统不成功,系统将关闭", , "登录"
End
Else
Exit Sub
End If
End If
If Trim(adoUser.Recordset.Fields("password")) <> Trim(txtPwd) Then
MsgBox "密码错误", , "登录"
TryTimes = TryTimes + 1
txtPwd.SelStart = 0
txtPwd.SelLength = Len(txtPwd)
txtPwd.SetFocus
If TryTimes >= 3 Then
MsgBox "已经三次尝试登录本系统不成功,系统即将关闭", , "登录"
End
Else
Exit Sub
End If
Else
strUserName = Trim(txtUserName)
Unload Me
End If
End Sub
Private Sub txtPwd_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdOk_Click
End If
End Sub
Public Sub main()
mfrmMain.Show
frmLogin.Show 1
End Sub 展开
txtUserName = ""
txtPwd = ""
txtUserName.SetFocus
End
End Sub
Private Sub cmdOk_Click()
If txtUserName = "" Then
MsgBox "请输入用户名", , "登录"
txtUserName.SetFocus
Exit Sub
End If
If txtPwd = "" Then
MsgBox "请输入密码", , "登录"
txtPwd.SetFocus
Exit Sub
End If
adoUser.RecordSource = "SELECT * FROM Users WHERE Username='" & Trim(txtUserName) & "'"
adoUser.Refresh
If adoUser.Recordset.EOF = True Then
MsgBox "用户名不存在", , "登录"
TryTimes = TryTimes + 1
If TryTimes >= 3 Then
MsgBox "已经三次尝试进入本系统不成功,系统将关闭", , "登录"
End
Else
Exit Sub
End If
End If
If Trim(adoUser.Recordset.Fields("password")) <> Trim(txtPwd) Then
MsgBox "密码错误", , "登录"
TryTimes = TryTimes + 1
txtPwd.SelStart = 0
txtPwd.SelLength = Len(txtPwd)
txtPwd.SetFocus
If TryTimes >= 3 Then
MsgBox "已经三次尝试登录本系统不成功,系统即将关闭", , "登录"
End
Else
Exit Sub
End If
Else
strUserName = Trim(txtUserName)
Unload Me
End If
End Sub
Private Sub txtPwd_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdOk_Click
End If
End Sub
Public Sub main()
mfrmMain.Show
frmLogin.Show 1
End Sub 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询