加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

VB Access登陆

发布时间:2020-12-16 22:30:47 所属栏目:大数据 来源:网络整理
导读: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 Integercnn.Open "Provider=
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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读