窗体上画一command,数据库为a ,表名为b
Private Sub Command1_Click()
Dim msgQk
msgQk = MsgBox(“清空数据库将清除所有数据!”, 32 + vbOKCancel, “请选择”)
If msgQk = 1 Then
Dim cnDel As New ADODB.Connection
Dim rDel As New ADODB.Recordset
Dim sqlDel1 As String
cnDel.Open “DBQ=” & App.Path & “\a.mdb;Driver={Microsoft Access Driver (*.mdb)};”
sqlDel1 = “delete * from b”
cnDel.Execute sqlDel1
MsgBox “数据库清空完成!”, 32, “完成”
cndel.close
End If
End Sub