VB ACCESS数据库清空
答案:2 悬赏:0 手机版
解决时间 2021-04-26 15:30
- 提问者网友:心牵心
- 2021-04-25 23:46
VB ACCESS数据库清空
最佳答案
- 五星知识达人网友:十鸦
- 2021-04-26 01:24
窗体上画一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
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
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯