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

📄 frmdel_user.frm

📁 用VB开发的一个学生管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Frmdel_user 
   Caption         =   "删除用户"
   ClientHeight    =   3120
   ClientLeft      =   60
   ClientTop       =   420
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3120
   ScaleWidth      =   4680
   StartUpPosition =   2  '屏幕中心
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   495
      Left            =   960
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   1320
      Visible         =   0   'False
      Width           =   2895
   End
   Begin VB.CommandButton cmd_cancel 
      Caption         =   "取消"
      Height          =   615
      Left            =   2520
      TabIndex        =   3
      Top             =   1920
      Width           =   1335
   End
   Begin VB.CommandButton cmd_OK 
      Caption         =   "确定"
      Height          =   615
      Left            =   720
      TabIndex        =   2
      Top             =   1920
      Width           =   1455
   End
   Begin VB.TextBox txtUser 
      Height          =   495
      Left            =   2160
      TabIndex        =   1
      Top             =   480
      Width           =   1815
   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          =   495
      Left            =   960
      TabIndex        =   0
      Top             =   600
      Width           =   1095
   End
End
Attribute VB_Name = "Frmdel_user"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmd_cancel_Click()
Unload Me
End Sub

Private Sub cmd_OK_Click()
Data1.Recordset.MoveFirst
Data1.Refresh

If txtUser = "" Then
MsgBox "请输入用户名", vbExclamation, "警告"
txtUser.SetFocus
Else

Do While Not Data1.Recordset.EOF
        If Trim(Data1.Recordset.Fields("UserName")) = Trim(txtUser.Text) Then
            Data1.Recordset.Delete
            'Data1.Recordset.Update
            MsgBox "用户删除成功", 48, "提示"
            Unload Me
            Exit Sub
            FrmMain.Show
        Else
          Data1.Recordset.MoveNext
        End If
          
Loop
          
MsgBox "用户名不存在", vbExclamation, "警告"
txtUser.Text = ""
txtUser.SetFocus
Exit Sub
End If

End Sub

Private Sub Form_Load()

Dim dbname As String
Dim sql As String
dbname = App.Path
If Right$(dbname, 1) <> "\" Then dbname = dbname & "\"
dbname = dbname & "student_MG.mdb"
Data1.DatabaseName = dbname
sql = "select * from " & "Users"
Data1.RecordSource = sql
End Sub

⌨️ 快捷键说明

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