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

📄 form1.frm

📁 实现图书信息管理
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Frmmain 
   Caption         =   "图书借阅系统用户登陆"
   ClientHeight    =   3975
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   9480
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   Picture         =   "Form1.frx":0442
   ScaleHeight     =   3975
   ScaleWidth      =   9480
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command3 
      Caption         =   "修改密码"
      Height          =   495
      Left            =   6840
      TabIndex        =   6
      Top             =   2640
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   495
      Left            =   6840
      TabIndex        =   5
      Top             =   3240
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "进入"
      Height          =   495
      Left            =   6840
      TabIndex        =   4
      Top             =   2040
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   3120
      Width           =   2775
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1800
      TabIndex        =   2
      Text            =   "Administrator"
      Top             =   2160
      Width           =   2775
   End
   Begin VB.Label Label2 
      Caption         =   "密码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   240
      TabIndex        =   1
      Top             =   3120
      Width           =   1335
   End
   Begin VB.Label Label1 
      Caption         =   "用户名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   2160
      Width           =   1575
   End
End
Attribute VB_Name = "Frmmain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim response

Private Sub Command1_Click()
If (Me.Text1.Text = "" Or Me.Text2.Text = "") Then
    response = MsgBox("请输入完整的用户名和密码!", vbOKOnly + vbExclamation, "注意")
Else
    Set cmd.ActiveConnection = cnn
    cmd.CommandText = "select * from Users where 用户名=" & "'" & Me.Text1.Text & "'"
    Set rs = cmd.Execute
    If rs.EOF = True Then
        response = MsgBox("此用户不存在", vbOKOnly + vbExclamation, "注意")
    Else
        If rs.Fields("密码") = Me.Text2.Text Then
           Unload Me
           Form2.Show
        Else
           response = MsgBox("密码错误", vbOKOnly + vbExclamation, "注意")
        End If
    End If
End If
End Sub

Private Sub Command2_Click()
cnn.Close
End
End Sub

Private Sub Command3_Click()
If Trim(Text1.Text) = "" Or Trim(Text2.Text) = "" Then
    response = MsgBox("请填入完整的信息", vbOKOnly + vbExclamation, "注意")
Else
    Set cmd.ActiveConnection = cnn
    cmd.CommandText = "select * from Users where 用户名=" & "'" & Trim(Text1.Text) & "' and " & _
                     "密码=" & "'" & Trim(Text2.Text) & "'"
    Set rs = cmd.Execute
    If rs.EOF Then
        response = MsgBox("用户名或密码错误", vbOKOnly + vbExclamation, "注意")
    Else
        updatepwd.Show 1
    End If
End If
End Sub

Private Sub Form_Load()
cnn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;" & _
    "Persist Security Info=False;Initial Catalog=XSBOOK;Data Source=(local)"
cnn.Open
End Sub

⌨️ 快捷键说明

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