⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmlogin.frm

📁 一个功能齐全的图书馆管理系统 可适用与中小学的图书馆的管理
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "登录对话框"
   ClientHeight    =   2595
   ClientLeft      =   2835
   ClientTop       =   3480
   ClientWidth     =   4170
   Icon            =   "frmLogin.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1533.212
   ScaleMode       =   0  'User
   ScaleWidth      =   3915.404
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   390
      Left            =   2400
      TabIndex        =   5
      Top             =   1800
      Width           =   1140
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   390
      Left            =   480
      TabIndex        =   4
      Top             =   1800
      Width           =   1140
   End
   Begin VB.TextBox txtUserName 
      DataField       =   "username"
      DataSource      =   "Adodc1"
      Height          =   345
      Left            =   1290
      TabIndex        =   1
      Top             =   135
      Width           =   2325
   End
   Begin VB.TextBox txtPassword 
      DataField       =   "pass"
      DataSource      =   "Adodc1"
      Height          =   345
      IMEMode         =   3  'DISABLE
      Left            =   1290
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   840
      Width           =   2325
   End
   Begin VB.Label lblLabels 
      Caption         =   "用户名称(&U):"
      Height          =   270
      Index           =   0
      Left            =   105
      TabIndex        =   0
      Top             =   150
      Width           =   1080
   End
   Begin VB.Label lblLabels 
      Caption         =   "密    码(&P):"
      Height          =   270
      Index           =   1
      Left            =   105
      TabIndex        =   2
      Top             =   900
      Width           =   1080
   End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String

Private Sub cmdCancel_Click()
Dim selevalue As Integer
Dim buttons1 As Integer
buttons1 = vbYesNo + vbQuestion
selevalue = MsgBox("您确认要退出管理系统吗?", buttons1, "退出系统")
Select Case selevalue
Case vbNo
Case vbYes
Unload Me
End Select

End Sub

Private Sub cmdOK_Click()
Dim user As String, pwd As String
    user = Trim(txtUserName)
    pwd = Trim(txtPassword)
 'Set rs = DataEn.rsuser1
   strSQL = "select * from user1 where username='" & user & "' and pass='" & pwd & "'"
    On Error Resume Next
    '查询DataEnv.rsuser1的状态,如果已经打开,则先关闭
    If rs.State = adStateOpen Then rs.Close
   rs.Open strSQL, cn, 1, 3
   'If rs.State = 1 Then
   'MsgBox "记录已经打开!"
  ' Else
  ' MsgBox "已经关闭!"
  ' End If
 Static nTryCount As Integer
 If rs.EOF Then   '登录失败
        MsgBox "对不起,无此用户或者密码不正确!请重新输入!!", vbCritical, "错误"
       txtUserName.SetFocus
        txtUserName.SelStart = 0
        txtUserName.SelLength = Len(txtUserName)
        nTryCount = nTryCount + 1
        If nTryCount >= 3 Then
            MsgBox "您无权操作本系统!", vbCritical, "错误"
            Unload Me
        End If
    Else            '登陆成功
      '显示MDI窗体, 并将用户类型和用户名传到MDI窗体中的mnUserType, msUserName中
     
      Load Formmain
      Formmain.Show
      Unload Me
      End If
      DataEn.rsuser1.Close
End Sub

Private Sub Form_Load()
'根据目录所在的位置,改变ADO所使用的的连接字符串
    Dim strConn As String
    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Password=;Data Source="
    '使用相对路径
    strConn = strConn & App.Path & "\database\manager.mdb" & ";Persist Security Info=True"
    cn.ConnectionString = strConn
cn.Open
'判断是否连接成功!
'If cn.State = 1 Then
'MsgBox "数据库连接成功!"
'Else
'MsgBox "连接失败!"
'End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -