📄 frmdeluser.frm
字号:
VERSION 5.00
Begin VB.Form frmDelUser
BorderStyle = 1 'Fixed Single
Caption = "删除用户"
ClientHeight = 4890
ClientLeft = 45
ClientTop = 330
ClientWidth = 3570
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4890
ScaleWidth = 3570
Begin VB.CommandButton cmdDel
Caption = "删除"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 405
TabIndex = 2
Top = 4050
Width = 972
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 1725
TabIndex = 1
Top = 4050
Width = 972
End
Begin VB.ListBox List1
Height = 2940
Left = 315
TabIndex = 0
Top = 780
Width = 2595
End
Begin VB.Label Label1
Caption = "用户列表:"
Height = 450
Left = 240
TabIndex = 3
Top = 345
Width = 1155
End
End
Attribute VB_Name = "frmDelUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdDel_Click()
Dim txtSQL As String
Dim intCount As Integer
Dim mrc As ADODB.Recordset
Dim MsgText As String
If List1.List(List1.ListIndex) <> "" Then
If MsgBox("真的要删除用户" & List1.List(List1.ListIndex), vbOKCancel + vbExclamation, "警告") = vbOK Then
txtSQL = "delete from 管理员 where username ='" & Trim(List1.List(List1.ListIndex)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
List1.Clear
Form_Load
End If
End If
MsgBox "删除成功", vbOKOnly, "信息框"
End Sub
Private Sub Form_Load()
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
txtSQL = "select username from 管理员"
Set mrc = ExecuteSQL(txtSQL, MsgText)
While mrc.EOF = False
List1.AddItem mrc.Fields(0)
mrc.MoveNext
Wend
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -