【VB开源代码栏目提醒】:以下是网学会员为您推荐的VB开源代码-admin_delete.frm,希望本篇文章对您学习有所帮助。
VERSION 5.00
Begin VB.Form admin_delete
Caption = "删除用户"
ClientHeight = 2865
ClientLeft = 60
ClientTop = 345
ClientWidth = 5055
LinkTopic = "Form1"
ScaleHeight = 2865
ScaleWidth = 5055
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "删除"
Height = 375
Left = 1800
TabIndex = 1
Top = 1680
Width = 975
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1440
Style = 2 'Dropdown List
TabIndex = 0
Top = 840
Width = 2055
End
Begin VB.Label Label1
Caption = "选择目标用户:"
Height = 375
Left = 720
TabIndex = 2
Top = 240
Width = 1455
End
End
Attribute VB_Name = "admin_delete"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
If Combo1.Text = "" Then
MsgBox "请选择目标用户"
Else
If Combo1.Text = "admin" Then
MsgBox "该用户是系统用户,不能删除"
Else
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\file.mdb;Persist Security Info=False"
sql = "select * from info_admin where account='" & Combo1.Text & "'"
rs.Open sql, cn, 3, 2
response = MsgBox("确定要删除该用户吗?", vbOKCancel + 32, "提示")
If response = vbOK Then
rs.Delete
MsgBox "删除成功"
End If
End If
End If
End Sub
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\file.mdb;Persist Security Info=False"
sql = "select * from info_admin "
rs.Open sql, cn, 1, 1
Do While rs.EOF <> True
Combo1.AddItem rs("account")
rs.MoveNext
Loop
End Sub
上一篇:
adduser.frm
下一篇:
多年来只想说一句,我不怪你