adodc1已经连接上表了,用下面代码为什么不能清空,点击按钮实时异常3219
adodc1已经连接上表了,用下面代码为什么不能清空,点击按钮实时错误3219
Private Sub Command4_Click()
With Adodc1.Recordset
.Delete adAffectAllChapters
End With
Adodc1.Recordset.Update
End Sub
------解决方案--------------------
数据库没有记录吧
------解决方案--------------------
try:
Private Sub Command4_Click()
With Adodc1.Recordset
.Delete adAffectAllChapters
End With
Adodc1.Recordset.Update
End Sub
------解决方案--------------------
数据库没有记录吧
------解决方案--------------------
try:
- VB code
Private Sub Command1_Click() Do While Not Adodc1.Recordset.EOF Adodc1.Recordset.Delete adAffectCurrent Adodc1.Recordset.MoveNext Loop End Sub
------解决方案--------------------
.Delete 'adAffectAllChapters,不要使用参数
------解决方案--------------------
------解决方案--------------------
If (Adodc1.Recordset.BOF Or Adodc1.Recordset.EOF) Then
MsgBox "无记录", , "提示"
End If
While Not Adodc1.Recordset.EOF()
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
Wend
MsgBox "记录已经删除vbOKOnly, "提示"
或者将数据库记录查询出来后 把ID也读出来执行下面代码
For i = ListView1.ListItems.Count To 1 Step -1
’If ListView1.ListItems(i).Checked = True Then
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path + "数据库.mdb;User ID=; Jet OLEDB:database Password = 密码"
sq1 = "Delete from 表 Where ID=" & ListView1.ListItems(i).SubItems(1)
cn.Execute (sq1)
cn.Close
Set cn = Nothing
ListView1.ListItems.Remove (i)
'End If
Next i
’ListView1.ListItems(i).SubItems(1)代表读出的ID号 ID为自动编号