📄 dialogdeldev.frm
字号:
VERSION 5.00
Begin VB.Form Dialogdeldev
BorderStyle = 3 'Fixed Dialog
Caption = "对话框标题"
ClientHeight = 2100
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 3525
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2100
ScaleWidth = 3525
ShowInTaskbar = 0 'False
Begin VB.ComboBox Combo1
Height = 300
Left = 600
TabIndex = 2
Top = 720
Width = 2295
End
Begin VB.CommandButton CancelButton
Caption = "取消"
Height = 375
Left = 2040
TabIndex = 1
Top = 1320
Width = 975
End
Begin VB.CommandButton OKButton
Caption = "确定"
Height = 375
Left = 600
TabIndex = 0
Top = 1320
Width = 1095
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "选择要删除的设备:"
Height = 375
Left = 240
TabIndex = 3
Top = 240
Width = 2655
End
End
Attribute VB_Name = "Dialogdeldev"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rst As ADODB.Recordset
Dim comm As ADODB.command
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim n As Integer
Set rst = New ADODB.Recordset
Set comm = New ADODB.command
comm.ActiveConnection = adoconn
comm.CommandText = "select *from sysdevices where cntrltype=2"
Set rst = comm.Execute(, , 1)
n = 0
While Not rst.EOF
Combo1.AddItem rst.Fields("name"), n
n = n + 1
rst.MoveNext
Wend
End Sub
Private Sub OKButton_Click()
If Combo1.Text <> "" Then
Me.MousePointer = 11 '改变鼠标样子
On Error GoTo er
comm.CommandText = "exec sp_dropdevice '" + Combo1.Text + "'"
comm.Execute , , 1
comm.CommandText = "delete from devicefileinfo where dename='" + Combo1.Text + "'"
comm.Execute , , 1
Me.MousePointer = 0 '改变鼠标样子
MsgBox "successfully completed!"
Unload Me
End If
Exit Sub
er:
MsgBox err.Description, 0, "错误信息"
Me.MousePointer = 0 '改变鼠标样子
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -