📄 frmdeluser.frm
字号:
VERSION 5.00
Begin VB.Form frmDelUser
BackColor = &H00FFC0C0&
Caption = "删除用户"
ClientHeight = 2865
ClientLeft = 60
ClientTop = 450
ClientWidth = 4800
LinkTopic = "Form1"
ScaleHeight = 2865
ScaleWidth = 4800
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 1440
TabIndex = 5
Top = 1920
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "取消"
Height = 375
Left = 2760
TabIndex = 4
Top = 1920
Width = 1095
End
Begin VB.ComboBox cboName
Height = 315
Left = 1440
Style = 2 'Dropdown List
TabIndex = 3
Top = 1200
Width = 2415
End
Begin VB.ComboBox cboType
Height = 315
ItemData = "frmDelUser.frx":0000
Left = 1440
List = "frmDelUser.frx":000D
Style = 2 'Dropdown List
TabIndex = 0
Top = 600
Width = 2415
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名*"
Height = 195
Index = 1
Left = 720
TabIndex = 2
Top = 1200
Width = 600
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "类型*"
Height = 255
Index = 0
Left = 840
TabIndex = 1
Top = 600
Width = 495
End
End
Attribute VB_Name = "frmDelUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Sql As String
Dim RS As ADODB.Recordset
Private Sub Command1_Click()
'删除用户
If Trim(Me.cboName.Text) <> "" Then
Sql = "select 密码 from 密码表 where 用户名='" & Trim(Me.cboName.Text)
Sql = Sql & "' and 类型='" & Trim(Me.cboType.Text) & "'"
Set RS = dbSelect(Sql)
If RS.EOF Then
MsgBox "库中无此用户!"
Else
Sql = "delete from 密码表 where 用户名='" & Trim(Me.cboName.Text)
Sql = Sql & "' and 类型='" & Trim(Me.cboType.Text) & "'"
dbOperate Sql
End If
Else
MsgBox "主键不能为空!"
End If
End Sub
Private Sub Command3_Click()
'关闭
Unload Me
End Sub
Private Sub Form_Load()
Sql = "select distinct 用户名 from 密码表 "
Set RS = dbSelect(Sql)
While Not RS.EOF
Me.cboName.AddItem RS.Fields(0)
RS.MoveNext
Wend
Me.cboType.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -