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

📄 增加用户r.frm

📁 功能强大的学生信息管理系统 用户:admin 密码:admin学生信息管理系统是典型的信息管理系统 (MIS)
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Frm_AddUser 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "增加用户"
   ClientHeight    =   3900
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4890
   Icon            =   "增加用户r.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3900
   ScaleWidth      =   4890
   StartUpPosition =   2  '屏幕中心
   Begin VB.ComboBox Combo1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   2040
      TabIndex        =   9
      Text            =   "Combo1"
      Top             =   2520
      Width           =   1815
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3000
      TabIndex        =   7
      Top             =   3240
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   840
      TabIndex        =   6
      Top             =   3240
      Width           =   1215
   End
   Begin VB.TextBox Text3 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2040
      PasswordChar    =   "*"
      TabIndex        =   5
      Text            =   "Text3"
      Top             =   1920
      Width           =   1815
   End
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2040
      PasswordChar    =   "*"
      TabIndex        =   3
      Text            =   "Text2"
      Top             =   1320
      Width           =   1815
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2040
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   720
      Width           =   1815
   End
   Begin VB.Label Label4 
      Caption         =   "身份:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   1320
      TabIndex        =   8
      Top             =   2520
      Width           =   735
   End
   Begin VB.Label Label3 
      Caption         =   "确定密码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   960
      TabIndex        =   4
      Top             =   1920
      Width           =   1095
   End
   Begin VB.Label Label2 
      Caption         =   "密码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   1320
      TabIndex        =   2
      Top             =   1320
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "用户名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   1200
      TabIndex        =   0
      Top             =   720
      Width           =   855
   End
End
Attribute VB_Name = "Frm_AddUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim myCon As New ADODB.Connection
Dim myRs As New ADODB.Recordset
Private Sub Command1_Click()
Dim strName, strPass, strPassAgain, strShenFen As String
    strName = Trim(Text1.Text)
    strPass = Trim(Text2.Text)
    strPassAgain = Trim(Text3.Text)
    strShenFen = Trim(Combo1.Text)
    
If strName = "" Or strPass = "" Or strPassAgain = "" Or strShenFen = "" Then
    MsgBox "请填写完整所有资料!", vbOKOnly, "警告"
    Text1.SetFocus
    Exit Sub
End If

myCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=信息.mdb;"
myRs.Open "select * from 用户资料 where 用户名='" & strName & "'", myCon

If Not myRs.EOF Then
    Text1.SetFocus
    MsgBox "该用户名已经存在,请使用其他用户名!", vbOKOnly, "警告"
    myRs.Close
    myCon.Close
    Exit Sub
End If

If strPass <> strPassAgain Then
    MsgBox "两次输入的密码不同!", vbOKOnly, "警告"
    Text3.SetFocus
    myRs.Close
    myCon.Close
    Exit Sub
End If
myRs.Close

myRs.CursorType = adOpenKeyset
myRs.LockType = adLockOptimistic
myRs.Open "用户资料", myCon, 3, 2
myRs.AddNew
myRs!用户名 = Text1.Text
myRs!密码 = Text2.Text
'myRs!确定密码 = Text3.Text
myRs!身份 = Combo1.Text
myRs.Update
myRs.Close
myCon.Close
    
MsgBox "注册成功!", vbOKOnly, "提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Combo1.Text = ""
Frm_LiulanUser.Adodc1.Refresh
Frm_LiulanUser.DataGrid1.Refresh
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Combo1.Text = ""
Combo1.AddItem ("管理员")
Combo1.AddItem ("用户")
End Sub

⌨️ 快捷键说明

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