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

📄 frmdl.frm

📁 图书管理系统VB版本
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Caption         =   "用户密码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   360
      TabIndex        =   8
      Top             =   2460
      Width           =   1275
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   360
      TabIndex        =   7
      Top             =   1830
      Width           =   1020
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户类型:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   360
      TabIndex        =   6
      Top             =   1200
      Width           =   1275
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H80000016&
      BackStyle       =   0  'Transparent
      Caption         =   "图书管理"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   36
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      Height          =   720
      Left            =   360
      TabIndex        =   5
      Top             =   240
      Width           =   3420
   End
End
Attribute VB_Name = "FrmDL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'声明管理员记录集
    Dim RecGLY As ADODB.Recordset
'声明工作人员记录集
    Dim RecGzry As ADODB.Recordset


Private Sub Form_Load()
'登陆界面显示在屏幕中央
    Me.Left = (Screen.Width - Me.Width) / 2
    Me.Top = (Screen.Height - Me.Height) / 2
'为了调试方便这里默认一个管理员
    Text1 = "张三"
    Text2 = "123"
End Sub

Private Sub Command1_Click()
On Error GoTo Line1
    Static i As Integer     '用来记录错误输入密码次数
'当用户名="管理员",连接管理员表
    If (Combo1.Text = "管理员") Then
        Set RecGLY = New ADODB.Recordset
        RecGLY.Open "select * from 管理员表 where GuanliyuanXingming='" & Trim(Text1) & "'", ConTSGL, _
        adOpenDynamic, adLockReadOnly, -1
        If Trim(Text2) = RecGLY!guanliyuanmima Then     '判断密码是否正确
            FrmMain.Show
            Me.Hide
        Else
            MsgBox "您输入的密码错误!"
            Text2 = ""
            Text2.SetFocus
            i = i + 1
            If i >= 3 Then End
        End If
'当用户名="工作人员",连接工作人员表
    ElseIf (Combo1.Text = "工作人员") Then
        Set RecGzry = New ADODB.Recordset
        RecGzry.Open "select * from 工作人员表 where GongzuoRenyuanXingming='" & Trim(Text1) & "'", _
        ConTSGL, adOpenDynamic, adLockReadOnly, -1
        If Trim(Text2) = RecGzry!gongzuorenyuanmima Then    '判断密码是否正确
            FrmMain.Show
            FrmMain.XitongGuanli.Enabled = False
            FrmMain.Duzhe.Enabled = False
            FrmMain.Shuji.Enabled = False
            Me.Hide
        Else
            MsgBox "您输入的密码错误!"
            Text2 = ""
            Text2.SetFocus
            i = i + 1
            If i >= 3 Then End
        End If
    Else
        MsgBox "请正确选择用户类型!", vbInformation + vbOKOnly, "提示:"
        Call Chushihua
    End If
Line1:
'通过错误号来判断表中是否存在此用户
    If Err.Number = 3021 Then
        MsgBox "无此用户!请重新输入。", vbExclamation + vbOKOnly, "提示:"
        Call Chushihua
        Err.Clear
    End If
End Sub

Private Sub Command2_Click()
    End
End Sub

Private Sub Check1_Click()
    If Check1 = 1 Then
        FrmDL.Height = 6500
        Command3.Enabled = True
    Else
        FrmDL.Height = 4815
        Command3.Enabled = False
    End If
End Sub

Private Sub Command3_Click()
If (Text3 = "" Or Text4 = "") Then MsgBox "请您输入修改密码!", vbExclamation + vbOKOnly, "提示:"
On Error GoTo Line1
    Static i As Integer     '用来记录错误输入密码次数
'当用户名="管理员",连接管理员表
    If (Combo1.Text = "管理员") Then
        Set RecGLY = New ADODB.Recordset
        RecGLY.Open "select * from 管理员表 where GuanliyuanXingming='" & Trim(Text1) & "'", ConTSGL, _
        adOpenDynamic, adLockOptimistic, -1
        If Trim(Text2) = RecGLY!guanliyuanmima Then     '判断密码是否正确
            If Trim(Text3) = Trim(Text4) Then
                RecGLY!guanliyuanmima = Trim(Text3)
                RecGLY.Update
                MsgBox "您的密码修改成功!", vbInformation, "修改成功:"
            Else
                MsgBox "您两次输入的密码不相同!", vbInformation, "输入有误:"
            End If
        Else
            MsgBox "您输入的原密码错误!"
            Text2 = ""
            Text2.SetFocus
            i = i + 1
            If i >= 3 Then End
        End If
'当用户名="工作人员",连接工作人员表
    ElseIf (Combo1.Text = "工作人员") Then
        Set RecGzry = New ADODB.Recordset
        RecGzry.Open "select * from 工作人员表 where GongzuoRenyuanXingming='" & Trim(Text1) & "'", _
        ConTSGL, adOpenDynamic, adLockOptimistic, -1
        If Trim(Text2) = RecGzry!gongzuorenyuanmima Then    '判断密码是否正确
            If Trim(Text3) = Trim(Text4) Then
                RecGzry!gongzuorenyuanmima = Trim(Text3)
                RecGzry.Update
                MsgBox "您的密码修改成功!", vbInformation, "修改成功:"
            Else
                MsgBox "您两次输入的密码不相同!", vbInformation, "输入有误:"
            End If
        Else
            MsgBox "您输入的原密码错误!"
            Text2 = ""
            Text2.SetFocus
            i = i + 1
            If i >= 3 Then End
        End If
    Else
        MsgBox "请正确选择用户类型!", vbInformation + vbOKOnly, "提示:"
        Call Chushihua
    End If
Line1:
'通过错误号来判断表中是否存在此用户
    If Err.Number = 3021 Then
        MsgBox "无此用户!请重新输入。", vbExclamation + vbOKOnly, "提示:"
        Call Chushihua
        Err.Clear
    End If
End Sub


Private Sub Command4_Click()
    Check1.Value = 0
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)     'text1中不能输入空格
    If KeyAscii = 32 Then KeyAscii = 0
    Text2.Enabled = True
End Sub

Private Sub Text2_GotFocus()        '用户名不能为空
    If Len(Text1) <= 0 Then
        MsgBox "您还没输入用户名!", vbInformation + vbOKOnly, "提示:"
        Call Chushihua
    End If
End Sub

Function Chushihua()        '初始化
    Combo1.Text = "管理员"
    Text1.SetFocus
    Text1 = ""
    Text2 = ""
    Text2.Enabled = False
End Function

⌨️ 快捷键说明

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