📄 deladm.frm
字号:
VERSION 5.00
Begin VB.Form deleteadm
BorderStyle = 1 'Fixed Single
Caption = "管理员的删除"
ClientHeight = 3675
ClientLeft = 6705
ClientTop = 2355
ClientWidth = 2595
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3675
ScaleWidth = 2595
Begin VB.Frame Frame1
Height = 3615
Left = 120
TabIndex = 0
Top = 0
Width = 2415
Begin VB.ListBox List1
Height = 2040
Left = 360
TabIndex = 2
Top = 720
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "删 除"
Height = 375
Left = 360
TabIndex = 1
Top = 3000
Width = 1575
End
Begin VB.Label Label1
Caption = "管理员名称"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000080FF&
Height = 375
Left = 360
TabIndex = 3
Top = 240
Width = 1695
End
End
End
Attribute VB_Name = "deleteadm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As New ADODB.Recordset
Dim sql As String
Public conn As New ADODB.Connection
Private Sub Command1_Click()
Dim strsql As String
sql = "select * from userid"
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
rs.find "userid ='" & List1.text & "'"
If rs.EOF = False Then
If MsgBox("你确定要删除管理员" & List1.text & "吗?", vbOKCancel + 48, "提示") = vbOK Then
rs.Delete
rs.Update
rs.MoveFirst
List1.Clear
For i = 0 To rs.RecordCount - 1
List1.AddItem rs.Fields("userid")
rs.MoveNext
Next i
Else
rs.Close
Exit Sub
End If
End If
rs.Close
End Sub
Private Sub Form_Load()
Dim i As Integer
List1.FontBold = True
List1.Appearance = 1
connstring = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\rsgl.mdb"
conn.Open connstring
sql = "select * from userid"
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
For i = 0 To rs.RecordCount - 1
List1.AddItem rs.Fields("userid")
rs.MoveNext
Next i
rs.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
conn.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -