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

📄 frmadduser.frm

📁 本系统是根据企业的特点
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmadduser 
   Caption         =   "添加用户"
   ClientHeight    =   3945
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6030
   LinkTopic       =   "Form1"
   ScaleHeight     =   3945
   ScaleWidth      =   6030
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text3 
      Height          =   495
      Left            =   3360
      TabIndex        =   7
      Top             =   2040
      Width           =   2175
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   3360
      TabIndex        =   6
      Top             =   1200
      Width           =   2175
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   3360
      TabIndex        =   5
      Top             =   360
      Width           =   2175
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   495
      Left            =   3600
      TabIndex        =   4
      Top             =   3120
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确认"
      Height          =   495
      Left            =   840
      TabIndex        =   3
      Top             =   3120
      Width           =   1575
   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          =   495
      Left            =   480
      TabIndex        =   2
      Top             =   2040
      Width           =   2295
   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          =   495
      Left            =   480
      TabIndex        =   1
      Top             =   1200
      Width           =   2175
   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          =   495
      Left            =   480
      TabIndex        =   0
      Top             =   360
      Width           =   2175
   End
End
Attribute VB_Name = "frmadduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Form_Load()
Set conn = New ADODB.Connection
conn.Open "DSN=电脑经营系统", ";pwd=14813808"
Set ado = New ADODB.Recordset
ado.Open "select * from 用户注册", conn, adOpenStatic, adLockOptimistic
End Sub


Private Sub Command1_Click()
Set conn = New ADODB.Connection
          conn.Open "DSN=电脑经营系统", ";pwd=14813808"
          Set ado = New ADODB.Recordset
          ado.Open "select * from 用户注册", conn, adOpenStatic, adLockOptimistic
Dim txtsql As String

If Text1.Text = "" Then
   MsgBox "请输入用户名!", vbOKOnly + vbExclamation, "警告“"
   Exit Sub
   Text1.SetFocus
Else
   txtsql = "select * from 用户注册 where 姓名'" & Trim(Text1.Text) & "'"
   While (ado.EOF = False)
   If ado.Fields("姓名") = Text1.Text Then
   MsgBox "用户已经存在,请重新输入", vbOKOnly + vbExclamation, "警告!"
   Text1.SetFocus
   Text1.Text = ""
   Text2.Text = ""
   Text3.Text = ""
   Exit Sub
 Else
     ado.MoveNext
   End If
Wend
End If

If Text2.Text <> Text3.Text Then
 MsgBox "两次输入密码不一样,请确认", vbOKOnly + vbExclamation, "警告!"
   Text2.SetFocus
   Text2.Text = ""
   Text3.Text = ""
  Exit Sub
Else
If Text2.Text = "" Then
 MsgBox "密码不能为空", vbOKOnly + vbExclamation, "警告!"
   Text2.SetFocus
   Text2.Text = ""
   Text3.Text = ""
Else
   ado.AddNew
   ado.Fields("姓名") = Text1.Text
   ado.Fields("密码") = Text2.Text
ado.Update
ado.Close
Me.Hide


Set conn = New ADODB.Connection
              conn.Open "DSN=电脑经营系统", ";pwd=14813808"
              Set adoch = New ADODB.Recordset
              adoch.Open "select * from 统计  where 姓名='" & Trim(Text1.Text) & "'", conn, 3, 2

adoch.AddNew
adoch.Fields("姓名") = Text1.Text
adoch.Update



 MsgBox "添加用户成功!", vbOKOnly + vbExclamation, "添加用户"
End If
End If
End Sub

   
   





⌨️ 快捷键说明

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