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

📄 frmlogin.frm

📁 这是我和同学编嘚图书馆管理信息系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmLogin 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "登录"
   ClientHeight    =   5925
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   8010
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "frmLogin.frx":0000
   ScaleHeight     =   5925
   ScaleWidth      =   8010
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Tag             =   "登录"
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   615
      Left            =   960
      Top             =   4680
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   1085
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=book"
      OLEDBString     =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=book"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   360
      Left            =   3480
      TabIndex        =   3
      Tag             =   "取消"
      Top             =   3480
      Width           =   1140
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   360
      Left            =   1440
      TabIndex        =   2
      Tag             =   "确定"
      Top             =   3480
      Width           =   1140
   End
   Begin VB.TextBox txtPassword 
      BorderStyle     =   0  'None
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   2760
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   2160
      Width           =   2325
   End
   Begin VB.TextBox txtUserName 
      BorderStyle     =   0  'None
      Height          =   270
      Left            =   2760
      TabIndex        =   0
      Top             =   1320
      Width           =   2325
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "图书馆管理信息系统"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   24
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000001&
      Height          =   615
      Left            =   1200
      TabIndex        =   6
      Top             =   240
      Width           =   4695
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "密码(&P):"
      Height          =   255
      Index           =   1
      Left            =   1200
      TabIndex        =   5
      Tag             =   "密码(&P):"
      Top             =   2160
      Width           =   1080
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "用户名(&U):"
      Height          =   255
      Index           =   0
      Left            =   1080
      TabIndex        =   4
      Tag             =   "用户名(&U):"
      Top             =   1320
      Width           =   1080
   End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public OK As Boolean




Private Sub cmdOK_Click()
Dim sql As String
Dim rs_login As New ADODB.Recordset
If Trim(txtUserName.Text) = "" Then            '判断输入的用户名是否为空
   MsgBox "没有这个用户", vbOKOnly + vbExclamation, ""
   txtUserName.SetFocus
Else
   sql = "select * from employees where username='" & txtUserName.Text & "'"
   rs_login.Open sql, connConnection, adOpenKeyset, adLockPessimistic
   If rs_login.EOF = True Then
      MsgBox "没有这个用户", vbOKOnly + vbExclamation, ""
     txtUserName.SetFocus
   Else                                  '检验密码是否正确
      If Trim(rs_login.Fields(2)) = Trim(txtPassword.Text) Then
          currentUser = txtUserName.Text
          rs_login.Close
          Unload Me
          frmMain.Show
      Else
         MsgBox "密码不正确", vbOKOnly + vbExclamation, ""
        txtPassword.SetFocus
      End If
   End If
End If

Exit Sub
End Sub


Private Sub Form_Load()
Set connConnection = New ADODB.Connection
connConnection.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=book"

End Sub


Private Sub txtUserName_LostFocus()
        If txtUserName.Text = "" Then
                MsgBox "请输入用户名", , "登录"
                txtUserName.SetFocus
        End If
End Sub

⌨️ 快捷键说明

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