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

📄 添加用户.frm

📁 VB的图书馆管理系统.管理员的帐号和密码都是
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form03 
   Caption         =   "添加用户"
   ClientHeight    =   4020
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6390
   LinkTopic       =   "Form6"
   ScaleHeight     =   4020
   ScaleWidth      =   6390
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame2 
      Height          =   855
      Left            =   1080
      TabIndex        =   15
      Top             =   3120
      Width           =   4215
      Begin VB.CommandButton Command2 
         Caption         =   "取消"
         Height          =   495
         Left            =   2400
         TabIndex        =   17
         Top             =   240
         Width           =   1215
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   495
         Left            =   600
         TabIndex        =   16
         Top             =   240
         Width           =   1095
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "用户信息修改"
      Height          =   2895
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   5895
      Begin VB.OptionButton Option2 
         Caption         =   "教师"
         Height          =   255
         Left            =   3360
         TabIndex        =   14
         Top             =   1920
         Width           =   1095
      End
      Begin VB.OptionButton Option1 
         Caption         =   "学生"
         Height          =   255
         Left            =   1320
         TabIndex        =   13
         Top             =   1920
         Value           =   -1  'True
         Width           =   975
      End
      Begin VB.TextBox Text6 
         Height          =   375
         Left            =   3720
         TabIndex        =   6
         Top             =   1320
         Width           =   1695
      End
      Begin VB.TextBox Text5 
         Height          =   375
         Left            =   960
         TabIndex        =   5
         Top             =   1320
         Width           =   1575
      End
      Begin VB.TextBox Text4 
         Height          =   375
         Left            =   3720
         TabIndex        =   4
         Top             =   840
         Width           =   1695
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   960
         TabIndex        =   3
         Top             =   840
         Width           =   1575
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   3720
         TabIndex        =   2
         Top             =   360
         Width           =   1695
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   960
         TabIndex        =   1
         Top             =   360
         Width           =   1575
      End
      Begin VB.Label Label7 
         Caption         =   "教师用户不用填班级和学号"
         Height          =   375
         Left            =   1560
         TabIndex        =   18
         Top             =   2400
         Width           =   2295
      End
      Begin VB.Label Label6 
         Caption         =   "性别"
         Height          =   375
         Left            =   2880
         TabIndex        =   12
         Top             =   1320
         Width           =   855
      End
      Begin VB.Label Label5 
         Caption         =   "姓名"
         Height          =   375
         Left            =   120
         TabIndex        =   11
         Top             =   1320
         Width           =   855
      End
      Begin VB.Label Label4 
         Caption         =   "学号"
         Height          =   375
         Left            =   2880
         TabIndex        =   10
         Top             =   840
         Width           =   735
      End
      Begin VB.Label Label3 
         Caption         =   "班级"
         Height          =   375
         Left            =   120
         TabIndex        =   9
         Top             =   840
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "系"
         Height          =   375
         Left            =   2880
         TabIndex        =   8
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "用户名"
         Height          =   375
         Left            =   120
         TabIndex        =   7
         Top             =   360
         Width           =   855
      End
   End
End
Attribute VB_Name = "Form03"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim ac As String
Dim ar As New ADODB.Recordset
Dim ad As New ADODB.Recordset
Dim acd  As New ADODB.Connection

If Option1.Value = ture Then
   If Trim(Text1.Text) = "" Then
     MsgBox "未输入用户名,请重新输入"
     Text1.SetFocus
     Exit Sub
    ElseIf Trim(Text2.Text) = "" Then
      MsgBox "未输入系别,请重新输入"
      Text2.SetFocus
      Exit Sub
    ElseIf Trim(Text3.Text) = "" Then
      MsgBox "未输入班级"
      Text3.SetFocus
      Exit Sub
    ElseIf (Text4.Text) = "" Then
      MsgBox "未输入学号"
      Text4.SetFocus
      Exit Sub
    ElseIf Trim(Text5.Text) = "" Then
      MsgBox "未输入姓名"
      Text5.SetFocus
      Exit Sub
      
    ElseIf Trim(Text6.Text) = "" Then
      MsgBox "未输入性别"
      Text6.SetFocus
      Exit Sub
    End If
   
ElseIf Option2.Value = True Then
    If Trim(Text1.Text) = "" Then
     MsgBox "未输入用户名,请重新输入"
     Text1.SetFocus
     Exit Sub
    ElseIf Trim(Text2.Text) = "" Then
      MsgBox "未输入系别,请重新输入"
      Text2.SetFocus
      Exit Sub
    ElseIf Trim(Text5.Text) = "" Then
      MsgBox "未输入姓名"
      Text5.SetFocus
      Exit Sub
    ElseIf Trim(Text6.Text) = "" Then
      MsgBox "未输入性别"
      Text6.SetFocus
      Exit Sub
    End If
End If

 acd.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\图书馆.mdb"
 ac = "select * from 用户信息  where 用户名='" & Text1.Text & "'"
 ar.Open ac, acd, adOpenKeyset, adLockOptimistic
  If ar.EOF Then
   ar.AddNew
   ar.Fields(0) = Text1.Text
   ar.Fields(1) = Text2.Text
   ar.Fields(2) = Text3.Text
   ar.Fields(3) = Text4.Text
   ar.Fields(4) = Text5.Text
   ar.Fields(5) = Text6.Text
    If Option1.Value = True Then
       ar.Fields(6) = "学生"
    ElseIf Option2.Value = True Then
        ar.Fields(6) = "教师"
    End If
   ar.Update
   ac = "select * from 密码"
   ad.Open ac, acd, adOpenKeyset, adLockPessimistic
   ad.AddNew
   ad.Fields(0) = Text1.Text
   ad.Fields(1) = Text1.Text
   ad.Fields(2) = "普通用户"
   ad.Update
   ad.Close
   MsgBox "用户添加成功", vbOKOnly + vbExclamation
 Else
      MsgBox "用户名重复,请重新输入"
      Text1.SetFocus
 End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

⌨️ 快捷键说明

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