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

📄 add2.frm

📁 这是学生做的人事档案系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form add2 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "添加管理员"
   ClientHeight    =   3090
   ClientLeft      =   5940
   ClientTop       =   1875
   ClientWidth     =   4020
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3090
   ScaleWidth      =   4020
   Begin VB.Frame Frame1 
      Height          =   3015
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   3855
      Begin VB.TextBox Text1 
         Height          =   495
         IMEMode         =   3  'DISABLE
         Left            =   1680
         TabIndex        =   5
         Top             =   360
         Width           =   1935
      End
      Begin VB.TextBox Text2 
         Height          =   495
         IMEMode         =   3  'DISABLE
         Left            =   1680
         PasswordChar    =   "*"
         TabIndex        =   4
         Top             =   1080
         Width           =   1935
      End
      Begin VB.TextBox Text3 
         Height          =   495
         IMEMode         =   3  'DISABLE
         Left            =   1680
         PasswordChar    =   "*"
         TabIndex        =   3
         Top             =   1800
         Width           =   1935
      End
      Begin VB.CommandButton Command1 
         Caption         =   "添加"
         Height          =   495
         Left            =   600
         TabIndex        =   2
         Top             =   2400
         Width           =   1455
      End
      Begin VB.CommandButton Command2 
         Caption         =   "放弃"
         Height          =   495
         Left            =   2160
         TabIndex        =   1
         Top             =   2400
         Width           =   1215
      End
      Begin MSAdodcLib.Adodc Adodc1 
         Height          =   330
         Left            =   0
         Top             =   2040
         Visible         =   0   'False
         Width           =   1560
         _ExtentX        =   2752
         _ExtentY        =   582
         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 VB.Label Label1 
         Caption         =   "管理员名称"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   120
         TabIndex        =   8
         Top             =   360
         Width           =   1335
      End
      Begin VB.Label Label2 
         Caption         =   "密  码"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   600
         TabIndex        =   7
         Top             =   1080
         Width           =   855
      End
      Begin VB.Label Label3 
         Caption         =   "确认密码"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   735
         Left            =   360
         TabIndex        =   6
         Top             =   1800
         Width           =   1095
      End
   End
End
Attribute VB_Name = "add2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim userid As String
Dim pwd As String
Dim pwd1 As String

Private Sub Command1_Click()
sql = "select * from userid"
rs.Open sql, conn, adOpenKeyset, adLockPessimistic

userid = Trim(Text1.text)
pwd = Trim(Text2.text)
pwd1 = Trim(Text3.text)
If userid = "" Then
MsgBox "管理员名称不能为空", vbOKOnly + 16, "提示"
Text1.SetFocus
rs.Close
Exit Sub

End If

If pwd = "" Then
MsgBox "密码不能为空", vbOKOnly + 16, "提示"
Text2.SetFocus
rs.Close
Exit Sub

End If
If pwd <> pwd1 Then
MsgBox "两次密码输入不一致", vbOKOnly + 16, "提示"
Text2.SetFocus
rs.Close
Exit Sub

End If

sql = "select * from userid where userid= ' " & userid & " '"
rs.find "userid='" & userid & "'"
If rs.EOF = True Then
rs.AddNew
rs.Fields("userid") = userid
rs.Fields("password") = pwd
rs.Update
rs.Close

MsgBox "管理员添加成功", vbOKOnly + 48, "提示"
Exit Sub
Else
MsgBox "对不起,该人员已经是管理员了", vbOKOnly + 48, "提示"
Text1.SetFocus
End If
rs.Close

End Sub

Private Sub Form_Load()
connstring = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\rsgl.mdb"
conn.Open connstring
End Sub

Private Sub Form_Unload(Cancel As Integer)
conn.Close
End Sub

⌨️ 快捷键说明

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