📄 frmdeluser.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmDelUser
BorderStyle = 1 'Fixed Single
Caption = "删除用户"
ClientHeight = 2265
ClientLeft = 3105
ClientTop = 2310
ClientWidth = 6030
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2265
ScaleWidth = 6030
Begin VB.Frame fraModi
Appearance = 0 'Flat
ForeColor = &H80000008&
Height = 2055
Left = 2040
TabIndex = 5
Top = 0
Width = 1815
Begin VB.CommandButton cmdValidate
Caption = "确认修改"
Height = 315
Left = 300
TabIndex = 8
Top = 960
Width = 1215
End
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 315
Index = 1
Left = 300
TabIndex = 7
Top = 1500
Width = 1215
End
Begin VB.ComboBox cboPurview
Height = 300
ItemData = "frmDelUser.frx":0000
Left = 300
List = "frmDelUser.frx":000A
Style = 2 'Dropdown List
TabIndex = 6
Top = 570
Width = 1215
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "选择权限"
Height = 180
Left = 480
TabIndex = 9
Top = 300
Width = 720
End
End
Begin VB.Frame fraDel
Appearance = 0 'Flat
ForeColor = &H80000008&
Height = 2055
Left = 4080
TabIndex = 1
Top = 0
Width = 1815
Begin VB.CommandButton cmdDelete
Caption = "删除用户"
Height = 315
Left = 300
TabIndex = 4
Top = 360
Width = 1215
End
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 315
Index = 0
Left = 300
TabIndex = 3
Top = 1470
Width = 1215
End
Begin VB.CommandButton cmdCancel
Caption = "取消删除"
Height = 315
Left = 300
TabIndex = 2
Top = 750
Width = 1215
End
End
Begin MSDataGridLib.DataGrid dgdUser
Height = 1935
Left = 120
TabIndex = 0
Top = 120
Width = 3855
_ExtentX = 6800
_ExtentY = 3413
_Version = 393216
DefColWidth = 73
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc adoUser
Height = 330
Left = 0
Top = 1920
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Stud97.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Stud97.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
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() '取消删除
adoUser.Recordset.CancelBatch
adoUser.Refresh
End Sub
Private Sub cmdDelete_Click() '删除按钮
If UCase$(adoUser.Recordset("用户名")) = "ADMIN" Then
MsgBox "不能删除“Admin”用户。", vbExclamation, " 提示"
Exit Sub
End If
Dim intRsp As Integer
Dim strQst As String
strQst = "删除用户“" & adoUser.Recordset("用户名") & "”吗?"
intRsp = MsgBox(strQst, vbQuestion + vbYesNo, "询问")
If intRsp = vbYes Then
adoUser.Recordset.Delete '不执行更新操作,可以取消删除
End If
End Sub
Private Sub cmdExit_Click(Index As Integer)
Unload Me
End Sub
Private Sub cmdValidate_Click() '确认对权限的修改
adoUser.Recordset("权限") = cboPurview.Text
End Sub
Private Sub Form_Activate() '窗体激活时
If Me.Caption = "删除用户" Then
fraDel.Visible = True
fraModi.Visible = False
Else
fraDel.Visible = False
fraModi.Visible = True
End If
End Sub
Private Sub Form_Load() '窗体加载
fraModi.Left = fraDel.Left '设置框架位置
fraModi.Top = fraDel.Top
With adoUser
.LockType = adLockBatchOptimistic '批更新模式,以备用户取消删除
.RecordSource = "SELECT * FROM 用户 "
.Refresh
End With
dgdUser.AllowUpdate = False '不允许修改DataGrid控件中显示的记录
Set dgdUser.DataSource = adoUser
End Sub
Private Sub Form_Unload(Cancel As Integer)
adoUser.Recordset.UpdateBatch '窗体卸载时对删除或更改权限操作进行更新
frmMain.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -