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

📄 frmzj.frm

📁 我VB遍的工资管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmzj 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "新增用户"
   ClientHeight    =   3195
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   Begin VB.CommandButton Commcancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   2760
      TabIndex        =   7
      Top             =   2520
      Width           =   975
   End
   Begin VB.CommandButton Commok 
      Caption         =   "确定"
      Height          =   375
      Left            =   840
      TabIndex        =   6
      Top             =   2520
      Width           =   975
   End
   Begin VB.TextBox Text3 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2280
      MaxLength       =   20
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   1800
      Width           =   1935
   End
   Begin VB.TextBox Text2 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2280
      MaxLength       =   20
      PasswordChar    =   "*"
      TabIndex        =   4
      Top             =   1080
      Width           =   1935
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   2280
      MaxLength       =   20
      TabIndex        =   3
      Top             =   360
      Width           =   1935
   End
   Begin VB.Label Label3 
      Caption         =   "密码确认:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   480
      TabIndex        =   2
      Top             =   1800
      Width           =   1455
   End
   Begin VB.Label Label2 
      Caption         =   "用户密码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   480
      TabIndex        =   1
      Top             =   1080
      Width           =   1455
   End
   Begin VB.Label Label1 
      Caption         =   "新增用户名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   480
      TabIndex        =   0
      Top             =   360
      Width           =   1455
   End
End
Attribute VB_Name = "frmzj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Commcancel_Click()
frmzj.Hide
'初始化文本框
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
'初始化主窗口
mainfrm.guanli.Enabled = True
mainfrm.chaxun.Enabled = True
mainfrm.tongji.Enabled = True
If userid = "admin" Then
mainfrm.xitong.Enabled = True
mainfrm.bdb.Enabled = True
Else
mainfrm.xitong.Enabled = False
mainfrm.bdb.Enabled = False
End If
mainfrm.Command1.Enabled = True
mainfrm.Command2.Enabled = True
mainfrm.Command3.Enabled = True
If userid = "admin" Then
mainfrm.Command4.Enabled = True
Else
mainfrm.Command4.Enabled = False
End If
GetStatus "<就绪>"
End Sub

Private Sub Commok_Click()
'声明变量
Dim cnn As New ADODB.Connection
Dim ret As New ADODB.Recordset
Dim local_db As String
Dim username As String
Dim password As String
'检查文本框是否为空
If Text1.Text = "" Then
MsgBox "用户名不能为空", , "警告"
Text1.SetFocus
Else
If Text2.Text = "" Then
MsgBox "密码不能为空", , "警告"
Text2.SetFocus
Else
If Text3.Text = "" Then
MsgBox "请确认密码", , "警告"
Text3.SetFocus
End If
End If
End If
If Text2.Text = Text3.Text Then
If Text1.Text <> "" And Text2.Text <> "" And Text3.Text <> "" Then
username = Trim(Text1.Text)
password = Text2.Text
Set cnn = New ADODB.Connection
Set ret = New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "\data\db.mdb" + ";Persist Security Info=False;" '连接数据库
local_db = "select 用户名 from 用户表" + _
" where 用户表.用户名=" + "'" + username + "'"
ret.Open local_db, cnn
'检查用户是否存在
If Not (ret.EOF And ret.BOF) Then
ret.Close
MsgBox "对不起,此用户已存在", , "警告"
Text1.SetFocus
'检查密码是否正确
Else
ret.Close
local_db = "insert into 用户表(用户名,密码)" + _
" values(" + "'" + username + "'," + "'" + password + "')"
cnn.Execute local_db
MsgBox "新用户添加成功!", , "提示"
frmzj.Hide
'初始化文本框
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
'初始化主窗口
mainfrm.guanli.Enabled = True
mainfrm.chaxun.Enabled = True
mainfrm.tongji.Enabled = True
If userid = "admin" Then
mainfrm.xitong.Enabled = True
mainfrm.bdb.Enabled = True
Else
mainfrm.xitong.Enabled = False
mainfrm.bdb.Enabled = False
End If
mainfrm.Command1.Enabled = True
mainfrm.Command2.Enabled = True
mainfrm.Command3.Enabled = True
If userid = "admin" Then
mainfrm.Command4.Enabled = True
Else
mainfrm.Command4.Enabled = False
End If
End If
End If
'检查密码是否一致
Else
If Text2.Text <> "" And Text3.Text <> "" Then
MsgBox "密码不一致,请重新输入", , "警告"
Text3.SetFocus
End If
End If
End Sub


⌨️ 快捷键说明

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