7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub Command1_Click()
Dim mrc As New ADODB.Recordset
'txtsql = " select * from oper where 用户名= '" & Trim$(Text1(0).Text) & " ' and 口令= ' " & Trim$(Text1(1).Text) + " ' "
txtsql = " select * from oper where 用户名= '1111' and 口令= '1111' "
'Text2.Text = txtsql
Set mrc = exesql(txtsql)
If mrc.eof or mrc.bof Then '未找到用户记录
n = n + 1
If n < 3 Then
MsgBox "没有该用户,继续登陆", vbOKOnly + vbExclamation, "信息提示"
Text1(0).Text = ""
Text1(1).Text = ""
Text1(0).SetFocus
Else
MsgBox "已登陆失败三次,退出系统", vbOKOnly + vbExclamation, "信息提示"
mcr.Close
Unload Me
End If
Else '找到合法用户
userlevel = Trim(mrc.Fields("级别"))
mrc.Close
Unload Me
menu.Show '调用主界面窗体
End If
End Sub
Dim micount As Integer
Private Sub Command1_Click()
Dim txtSql As String
Dim mrc As ADODB.Recordset
Dim msgtext As String
UserName = "" '这是个全局变量
If Trim(txtUserName.Text = "") Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
txtSql = "select * from financer where 用户名='" & txtUserName.Text & "'"
Set mrc = ExecuteSQL(txtSql, msgtext) '这个ExecuteSQL也是个自定义的函数
If mrc.EOF = True Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
If Trim(mrc.Fields("密码")) = Trim(txtpassword.Text) Then
OK = True
mrc.Close
Me.Hide
UserName = Trim(txtUserName.Text)
Else
MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtpassword.SetFocus
txtpassword.Text = ""
End If
End If
End If
micount = micount + 1
If micount = 3 Then
Me.Hide
End If
End Sub