登陆界面
2016-06-16 17:34
344 查看
Option Explicit
Const MaxLoginTimes As Integer = 3
Private Sub cmdLogin_Click()
Static loginTimes As Integer
loginTimes = loginTimes + 1
If loginTimes < MaxLoginTimes Then
On Error GoTo ppp
Dim Cn As Connection
Dim Rs As Recordset
Dim strSQL As String
Set Cn = New Connection
Set Rs = New Recordset
Cn.ConnectionString = " provider=Microsoft.Jet.OLEDB.3.51;Data Source=C:\Users\jf\Desktop\TestExample.mdb"
Cn.Open
Rs.ActiveConnection = Cn
strSQL = "select UserPassword from UserInformation where UserID= '" & Me.txtUserID.Text & "'"
Rs.Open (strSQL)
If Rs.EOF = True Then
MsgBox txtUserID.Text & "不存在"
Me.txtUserID.SetFocus
Me.txtUserID.SelStart = 0
Me.txtUserID.SelLength = Len(Me.txtUserID.Text)
Else
If Rs.Fields("UserPassword").Value = Me.txtPassword.Text Then
MsgBox "登录成功"
Unload Me
'frmNew.show
Else
MsgBox "密码错误"
End If
End If
ppp:
Cn.Close
Else
MsgBox "亲,您的输入次数超过允许的最大次数", vbCritical, "登录"
End If
End Sub
Const MaxLoginTimes As Integer = 3
Private Sub cmdLogin_Click()
Static loginTimes As Integer
loginTimes = loginTimes + 1
If loginTimes < MaxLoginTimes Then
On Error GoTo ppp
Dim Cn As Connection
Dim Rs As Recordset
Dim strSQL As String
Set Cn = New Connection
Set Rs = New Recordset
Cn.ConnectionString = " provider=Microsoft.Jet.OLEDB.3.51;Data Source=C:\Users\jf\Desktop\TestExample.mdb"
Cn.Open
Rs.ActiveConnection = Cn
strSQL = "select UserPassword from UserInformation where UserID= '" & Me.txtUserID.Text & "'"
Rs.Open (strSQL)
If Rs.EOF = True Then
MsgBox txtUserID.Text & "不存在"
Me.txtUserID.SetFocus
Me.txtUserID.SelStart = 0
Me.txtUserID.SelLength = Len(Me.txtUserID.Text)
Else
If Rs.Fields("UserPassword").Value = Me.txtPassword.Text Then
MsgBox "登录成功"
Unload Me
'frmNew.show
Else
MsgBox "密码错误"
End If
End If
ppp:
Cn.Close
Else
MsgBox "亲,您的输入次数超过允许的最大次数", vbCritical, "登录"
End If
End Sub
相关文章推荐
- 如何把PDF文件内容转换成TXT
- SQL注入(PreparedStatement)
- mongo中删除filed不存在的document
- IOS数据库操作SQLite3使用详解
- IPC网络高清摄像机基础知识5(经典YUV格式详解)
- iOS应用性能调优建议
- 选择法排序
- 信息
- 禁止ViewPager滑动
- 使用junit进行单元测试的注解的执行顺序。
- 用keytool创建Keystore和Trustsotre文件
- 【VMCloud云平台】拥抱Docker(五)Volume(2)
- android 中 Drawable 和 ConstantState 的一些认识
- HC-05嵌入式蓝牙串口通讯
- SpringMVC详细示例实战教程
- Oracle 查看表空间的大小及使用情况sql语句
- css绝对定位和相对定位
- Android的网络Http判断是否连接服务器
- 算法导论 01背包实现
- 求数组和的最高效的方法