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

📄 user1.frm

📁 学生关系管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmuser1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "新增用户"
   ClientHeight    =   4425
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6510
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4425
   ScaleWidth      =   6510
   Begin VB.Frame Frame1 
      Caption         =   "新增用户"
      ForeColor       =   &H000000FF&
      Height          =   2775
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6015
      Begin VB.TextBox Text1 
         Appearance      =   0  'Flat
         BackColor       =   &H80000018&
         ForeColor       =   &H000000FF&
         Height          =   270
         IMEMode         =   3  'DISABLE
         Index           =   2
         Left            =   4200
         PasswordChar    =   "*"
         TabIndex        =   7
         TabStop         =   0   'False
         Top             =   720
         Width           =   855
      End
      Begin VB.CommandButton Command2 
         Caption         =   "取消"
         Height          =   255
         Left            =   3600
         TabIndex        =   6
         Top             =   1920
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   255
         Left            =   1200
         TabIndex        =   5
         Top             =   1920
         Width           =   1095
      End
      Begin VB.TextBox Text1 
         Appearance      =   0  'Flat
         BackColor       =   &H80000018&
         ForeColor       =   &H000000FF&
         Height          =   270
         IMEMode         =   3  'DISABLE
         Index           =   1
         Left            =   2400
         PasswordChar    =   "*"
         TabIndex        =   3
         TabStop         =   0   'False
         Top             =   720
         Width           =   855
      End
      Begin VB.TextBox Text1 
         Appearance      =   0  'Flat
         BackColor       =   &H80000018&
         ForeColor       =   &H000000FF&
         Height          =   270
         Index           =   0
         Left            =   2400
         TabIndex        =   1
         TabStop         =   0   'False
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label3 
         Caption         =   "确定密码:"
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   3360
         TabIndex        =   8
         Top             =   750
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "密码:"
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   1800
         TabIndex        =   4
         Top             =   750
         Width           =   975
      End
      Begin VB.Label Label2 
         Caption         =   "新用户名:"
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   1440
         TabIndex        =   2
         Top             =   390
         Width           =   975
      End
   End
End
Attribute VB_Name = "frmuser1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Trim(Text1(0).Text) = "" Then
 MsgBox "用户名不能为空!", vbExclamation + vbOKOnly, "警告"
 Text1(0).SetFocus
 Exit Sub
End If
If Trim(Text1(1).Text) = "" Then
 MsgBox "密码不能为空!", vbExclamation + vbOKOnly, "警告"
 Text1(1).SetFocus
 Exit Sub
End If
If Trim(Text1(2).Text) = "" Then
 MsgBox "确认密码不能为空!", vbExclamation + vbOKOnly, "警告"
 Text1(2).SetFocus
 Exit Sub
End If
If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then
 MsgBox "确认密码不正确!", vbExclamation + vbOKOnly, "警告"
 Text1(2).SetFocus
 Exit Sub
End If


Dim mrc As ADODB.Recordset
txtsql = "select * from use where username='" & Trim(Text1(0).Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = False Then
  MsgBox " 已存在该用户!", vbExclamation + vbOKOnly, "警告"
  Text1(0).SetFocus
  Text1(0).SelStart = 0
  Text1(0).SelLength = Len(Text1(0).Text)
  Exit Sub
End If
txtsql = "select * from use"
Set mrc = ExecuteSQL(txtsql)
mrc.AddNew
  mrc.Fields(0) = Trim(Text1(0).Text)
  mrc.Fields(1) = Trim(Text1(1).Text)

  
   
 

   
  

   mrc.Update
   MsgBox " 用户添加成功!", vbExclamation + vbOKOnly, "警告"
   Text1(0).Text = ""
   Text1(1).Text = ""
   Text1(2).Text = ""
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Resize()
Text1(0).SetFocus
End Sub

Private Sub Option1_Click(Index As Integer)

End Sub

⌨️ 快捷键说明

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