Dim dr As DataRow
Dim Ok As Boolean
Dim zhanghao As String = e.Form.Controls("账号1").Value
Dim mima As String = e.Form.Controls("密码1").Value
If zhanghao = Nothing Then
MessageBox.Show("请输入您的登录账号!", "错误提示!",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.Cancel = True
ElseIf mima = Nothing Then
MessageBox.Show("请输入您的登录密码!", "错误提示!",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.Cancel = True
Else
DataTables("账户管理").LoadFilter= "[用户账号] = '" & zhanghao & "'"
DataTables("账户管理").Load
dr = DataTables("账户管理").Find("[用户账号] = '" & zhanghao & "'")
If dr Is Nothing Then
Messagebox.show("登陆账号和密码不一致!","错误提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.Cancel = True
ElseIf dr("用户密码") <> MD5Encrypt(mima) Then ' 注意这里的MD5加密.
Messagebox.show("登陆账号和密码不一致!","错误提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.Cancel = True
ElseIf dr("用户状态") = True Then
Messagebox.show("该账号已经登陆,不能重复登陆!","错误提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.Cancel = True
ElseIf dr("账号状态") = False Then
Messagebox.show("该账号已经被锁定,禁止登录!","错误提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.Cancel = True
Else
dr("用户状态") = True
DataTables.Save()
e.Form.BaseForm.Hide()
e.Form.close
Forms("主界面").Open()
End If
End If