VB Access登陆

If Text1.Text <> "" And Text2.Text <> "" Then
   Dim cnn As ADODB.Connection  '定义连接
   Dim Rs As ADODB.Recordset
   Set cnn = New ADODB.Connection '定义连接
   Set Rs = New ADODB.Recordset
   Dim strSQL As String
   Static trytime As Integer
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& App.Path & _
"\考勤管理系统.mdb;Persist Security Info=False;Jet OLEDB:Database Password=020135" '创建连接"
   Rs.Open "select    1    from    [用户信息]    where    用户名称='" _
   & Text1.Text & "'    and    用户密码='" & Text2.Text & "'and 用户类型='" _
   & Combo1 & "'", cnn, adOpenKeyset, _
   adLockBatchOptimistic '对用户输入的用户名、密码和用户类型与数据库进行匹配
       If Rs.EOF Then
       MsgBox "用户名称或密码错误!", vbOKOnly + vbExclamation, "警告"
           Text1.Text = ""
           Text2.Text = ""
           Text1.SetFocus
           trytime = trytime + 1
           If trytime >= 3 Then
           MsgBox "您已连续输入错误达3次!系统将自动关闭!!", vbExclamation + vbOKOnly, "温馨提示"
           cnn.Close
           End
           Else
           Exit Sub
        End If
     End If



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值