📄 deluser.frm
字号:
VERSION 5.00
Begin VB.Form frmDelUser
BackColor = &H00FFC0C0&
Caption = "删除帐号"
ClientHeight = 1815
ClientLeft = 60
ClientTop = 450
ClientWidth = 3450
LinkTopic = "Form1"
ScaleHeight = 1815
ScaleWidth = 3450
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 1920
TabIndex = 5
Top = 1200
Width = 1095
End
Begin VB.TextBox Text1
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 4
Top = 720
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "删除"
Height = 375
Left = 480
TabIndex = 3
Top = 1200
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1560
Style = 2 'Dropdown List
TabIndex = 0
Top = 240
Width = 1695
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "你的管理员密码"
Height = 255
Left = 120
TabIndex = 2
Top = 720
Width = 1335
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "选择要删除帐号"
Height = 255
Left = 120
TabIndex = 1
Top = 240
Width = 1335
End
End
Attribute VB_Name = "frmDelUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODb.Connection
Dim rs_del As New ADODb.Recordset
Dim sql_del As String
Private Sub Command1_Click()
If Combo1.Text = "" Then
MsgBox "请选择要删除的帐号!"
Exit Sub
ElseIf Text1.Text = "" Then
MsgBox "请输入你的管理员密码!"
Exit Sub
Else
TiShi = MsgBox("确定要删除帐号【" & Combo1.Text & "】吗?", vbYesNo + vbQuestion, "提示")
If TiShi = vbYes Then
rs_del.Close
sql_del = "select * from 管理员 where 登录帐号='" & Combo1.Text & "'"
rs_del.Open sql_del, conn, adOpenKeyset, adLockPessimistic
rs_del.Delete
rs_del.Update
Unload Me
Else
Exit Sub
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
DBpath = App.Path + "\database\school.mdb"
strSql = "provider=Microsoft.Jet.oledb.4.0;data source=" & DBpath & ";Jet OLEDB:Database Password=" & pwd & ";"
conn.Open strSql
strSql = "Select * from [管理员]"
rs_del.Open strSql, conn, adOpenKeyset, adLockPessimistic
Total = rs_del.RecordCount
For I = 1 To Total
Combo1.AddItem rs_del.Fields("登录帐号")
rs_del.MoveNext
Next I
End Sub
Private Sub Form_Unload(Cancel As Integer)
rs_del.Close
Set rs_del = Nothing
conn.Close
Set conn = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -