📄 form1.frm
字号:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form Form1
Caption = "部分或全部清除数据库数据"
ClientHeight = 3750
ClientLeft = 60
ClientTop = 345
ClientWidth = 8610
LinkTopic = "Form1"
ScaleHeight = 3750
ScaleWidth = 8610
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command3
Caption = "退出"
Height = 360
Left = 6975
TabIndex = 3
Top = 3330
Width = 1575
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "E:\明日vb编程500例\数据库\清空数据库\mrlc.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 420
Left = 45
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "kc"
Top = 3270
Visible = 0 'False
Width = 1635
End
Begin MSDBGrid.DBGrid DBGrid1
Bindings = "Form1.frx":0000
Height = 3165
Left = 75
OleObjectBlob = "Form1.frx":0014
TabIndex = 2
Top = 75
Width = 8475
End
Begin VB.CommandButton Command1
Caption = "清空库存为零的"
Height = 360
Left = 3690
TabIndex = 0
Top = 3330
Width = 1575
End
Begin VB.CommandButton Command2
Caption = "全部清空"
Height = 360
Left = 5340
TabIndex = 1
Top = 3330
Width = 1575
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim db As Database
Set db = Workspaces(0).OpenDatabase(App.Path & "\mrlc.mdb")
Dim sql As String
sql = "delete * from kc where kc.库存=0"
db.Execute sql
Data1.Refresh
End Sub
Private Sub Command2_Click()
Dim db As Database
Set db = Workspaces(0).OpenDatabase(App.Path & "\mrlc.mdb")
Dim sql As String
sql = "delete * from kc "
db.Execute sql
Data1.Refresh
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -