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

📄 adduserfrm.frm

📁 一个票务管理软件
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form adduserfrm 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "添加用户"
   ClientHeight    =   6330
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   8400
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6330
   ScaleWidth      =   8400
   ShowInTaskbar   =   0   'False
   Begin MSAdodcLib.Adodc Adouser 
      Height          =   375
      Left            =   3360
      Top             =   6000
      Visible         =   0   'False
      Width           =   1815
      _ExtentX        =   3201
      _ExtentY        =   661
      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         =   ""
      OLEDBString     =   ""
      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 MSDataGridLib.DataGrid dtguserinfo 
      Bindings        =   "adduserfrm.frx":0000
      Height          =   1935
      Left            =   240
      TabIndex        =   15
      Top             =   3120
      Width           =   6495
      _ExtentX        =   11456
      _ExtentY        =   3413
      _Version        =   393216
      AllowUpdate     =   -1  'True
      HeadLines       =   1
      RowHeight       =   15
      AllowDelete     =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Caption         =   "用户信息表"
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin VB.CommandButton cmddel 
      Caption         =   "删除用户"
      Height          =   495
      Left            =   2280
      TabIndex        =   14
      Top             =   5520
      Width           =   1695
   End
   Begin VB.ComboBox Comboqx 
      Height          =   300
      Left            =   1680
      TabIndex        =   13
      Top             =   2280
      Width           =   1215
   End
   Begin VB.CommandButton cmdexit 
      Caption         =   "退出"
      Height          =   495
      Left            =   6360
      TabIndex        =   11
      Top             =   5520
      Width           =   1695
   End
   Begin VB.CommandButton cmdcancel 
      Caption         =   "取消操作"
      Height          =   495
      Left            =   4320
      TabIndex        =   10
      Top             =   5520
      Width           =   1695
   End
   Begin VB.CommandButton cmdadd 
      Caption         =   "添加用户"
      Height          =   495
      Left            =   240
      TabIndex        =   9
      Top             =   5520
      Width           =   1695
   End
   Begin VB.Frame Frame1 
      Caption         =   "用户信息"
      Height          =   2655
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   6495
      Begin VB.TextBox txtpassword2 
         Height          =   375
         IMEMode         =   3  'DISABLE
         Left            =   4320
         PasswordChar    =   "*"
         TabIndex        =   8
         Top             =   1320
         Width           =   1095
      End
      Begin VB.TextBox txtpassword 
         Height          =   375
         IMEMode         =   3  'DISABLE
         Left            =   1440
         PasswordChar    =   "*"
         TabIndex        =   6
         Top             =   1320
         Width           =   1095
      End
      Begin VB.TextBox txtgonghao 
         Height          =   375
         Left            =   4320
         TabIndex        =   4
         Top             =   480
         Width           =   1095
      End
      Begin VB.TextBox txtuser 
         Height          =   375
         Left            =   1440
         TabIndex        =   2
         Top             =   480
         Width           =   1095
      End
      Begin VB.Label Label5 
         Caption         =   "权限"
         Height          =   255
         Left            =   960
         TabIndex        =   12
         Top             =   2160
         Width           =   495
      End
      Begin VB.Label Label4 
         Caption         =   "确认密码"
         Height          =   375
         Left            =   3480
         TabIndex        =   7
         Top             =   1440
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "密码"
         Height          =   375
         Left            =   960
         TabIndex        =   5
         Top             =   1440
         Width           =   735
      End
      Begin VB.Label Label2 
         Caption         =   "用户工号"
         Height          =   375
         Left            =   3480
         TabIndex        =   3
         Top             =   600
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "姓名"
         Height          =   495
         Left            =   960
         TabIndex        =   1
         Top             =   600
         Width           =   495
      End
   End
End
Attribute VB_Name = "adduserfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub cmdadd_Click()
Dim conuser As New ADODB.Connection
Dim cmduser As New ADODB.Command
Dim rstuser As New ADODB.Recordset
Dim strcnn As String

'输入数据进行验证
If Len(Trim(txtuser.Text)) = 0 Then
MsgBox "用户名没有输入,请输入!", vbOKOnly
Exit Sub
Else
txtuser.Text = CStr(Trim(txtuser.Text))
End If

If Len(Trim(txtgonghao.Text)) = 0 Then
MsgBox "工号没有输入,请输入!", vbOKOnly
Exit Sub
Else
txtgonghao.Text = CStr(Trim(txtgonghao.Text))
End If
 
If Len(Trim(txtpassword.Text)) = 0 Then
MsgBox "密码没有输入,请输入!", vbOKOnly
Exit Sub
Else
txtpassword.Text = CStr(Trim(txtpassword.Text))
End If

If Len(Trim(txtpassword2.Text)) = 0 Then
MsgBox "请输入确认密码!", vbOKOnly
Exit Sub
Else
txtpassword2.Text = CStr(Trim(txtpassword2.Text))
End If

If txtpassword.Text <> txtpassword2.Text Then
MsgBox "确认密码和第一次输入的密码不同,请重新输入!", vbOKOnly
Exit Sub
End If

strcnn = "insert into userinfo(username,userid,userpassword,userjibie)values('" & txtuser & "','" & txtgonghao & "','" & txtpassword & "','" & Comboqx.Text & "')"
 
With conuser
If .State = adStateOpen Then
   .Close
End If
   .Provider = "microsoft.jet.oledb.4.0"
   .ConnectionString = App.Path & "\jinbin.mdb"
   .ConnectionTimeout = 10
   .Open
End With

With cmduser
   .ActiveConnection = conuser
   .CommandType = adCmdText
   .CommandText = strcnn
   .Execute
End With

MsgBox "添加用户信息到数据库的操作成功", vbOKOnly, "确认框"
txtuser.Text = ""
txtgonghao.Text = ""
txtpassword.Text = ""
txtpassword2.Text = ""

strcnn = "select userid as 用户工号, username as 用户姓名,userjibie as 用户级别 from userinfo"

With rstuser
   .CursorLocation = adUseClient
   .CursorType = adOpenStatic
   .LockType = adLockOptimistic
   .ActiveConnection = conuser
   .Open strcnn, Options:=adCmdText
   Set Adouser.Recordset = rstuser
   dtguserinfo.ReBind
End With


End Sub

Private Sub cmdcancel_Click()
txtuser.Text = ""
txtgonghao.Text = ""
txtpassword.Text = ""
txtpassword2.Text = ""
End Sub



Private Sub cmddel_Click()
Dim conuser As New ADODB.Connection
Dim cmduser As New ADODB.Command
Dim rstuser As New ADODB.Recordset
Dim strcnn As String

'输入数据进行验证
If Len(Trim(txtuser.Text)) = 0 Then
MsgBox "用户名没有输入,请输入!", vbOKOnly
Exit Sub
Else
txtuser.Text = CStr(Trim(txtuser.Text))
End If

If Len(Trim(txtgonghao.Text)) = 0 Then
MsgBox "工号没有输入,请输入!", vbOKOnly
Exit Sub
Else
txtgonghao.Text = CStr(Trim(txtgonghao.Text))
End If
 
strcnn = "delete from userinfo where username='" & txtuser & "' and userid='" & txtgonghao & "'"
 With conuser
        If .State = adStateOpen Then
           .Close
        End If
        .Provider = "microsoft.jet.oledb.4.0"
        .ConnectionString = App.Path & "\jinbin.mdb"
        .ConnectionTimeout = 10
        .Open
 End With

 With cmduser
        .ActiveConnection = conuser
        .CommandType = adCmdText
        .CommandText = strcnn
        .Execute
 End With

MsgBox "删除用户成功!", vbOKOnly
txtuser.Text = ""
txtgonghao.Text = ""

strcnn = "select userid as 用户工号, username as 用户姓名,userjibie as 用户级别 from userinfo"

With rstuser
   .CursorLocation = adUseClient
   .CursorType = adOpenStatic
   .LockType = adLockOptimistic
   .ActiveConnection = conuser
   .Open strcnn, Options:=adCmdText
   Set Adouser.Recordset = rstuser
    dtguserinfo.ReBind
End With
End Sub

Private Sub cmdexit_Click()
adduserfrm.Hide
Unload Me
End Sub



Private Sub Form_Load()

Comboqx.AddItem "高级用户"
Comboqx.AddItem "一般用户"

Dim conuser As New ADODB.Connection
Dim cmduser As New ADODB.Command
Dim rstuser As New ADODB.Recordset
Dim strcnn As String

strcnn = "select userid as 用户工号, username as 用户姓名,userjibie as 用户级别 from userinfo"

With conuser
If .State = adStateOpen Then
   .Close
End If
   .Provider = "microsoft.jet.oledb.4.0"
   .ConnectionString = App.Path & "\jinbin.mdb"
   .ConnectionTimeout = 10
   .Open
End With

With rstuser
   .CursorLocation = adUseClient
   .CursorType = adOpenStatic
   .LockType = adLockOptimistic
   .ActiveConnection = conuser
   .Open strcnn, Options:=adCmdText
  Set Adouser.Recordset = rstuser
    dtguserinfo.ReBind
End With
End Sub

⌨️ 快捷键说明

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