📄 frmdeluser.frm
字号:
VERSION 5.00
Begin VB.Form 删除用户
BorderStyle = 1 'Fixed Single
Caption = "删除用户"
ClientHeight = 4695
ClientLeft = 45
ClientTop = 330
ClientWidth = 3570
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
Picture = "frmDelUser.frx":0000
ScaleHeight = 4695
ScaleWidth = 3570
Begin VB.CommandButton cmdDel
Caption = "删除"
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 2
Top = 3960
Width = 1095
End
Begin VB.CommandButton cmdCancel
BackColor = &H00FFFFFF&
Caption = "取消"
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2040
TabIndex = 1
Top = 3960
Width = 1095
End
Begin VB.ListBox List1
Height = 2940
Left = 315
TabIndex = 0
Top = 780
Width = 2940
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用户列表:"
ForeColor = &H00FFFFFF&
Height = 450
Left = 240
TabIndex = 3
Top = 345
Width = 1155
End
End
Attribute VB_Name = "删除用户"
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 UserName <> "Admin" Then
'判断用户的权限
MsgBox "只有超级管理员才有此权限!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
If List1.List(List1.ListIndex) <> "" Then
If MsgBox("真的要删除用户" & List1.List(List1.ListIndex), vbOKCancel + vbExclamation, "警告") = vbOK Then
If List1.List(List1.ListIndex) = "Admin" Then
MsgBox "不能删除超级用户", vbOKOnly, "信息框"
Exit Sub
End If
txtSQL = "delete from Manager 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 Manager "
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 + -