recordcount 未能取得记录数With DelRs
if not .eof then
.movefirst
.moveend
else
exit sub
end if
For i = 1 To .RecordCount
.Delete
.Update
.MoveNext
If .EOF Then Exit For
Next
End With
if not .eof then
.movefirst
.moveend
else
exit sub
end if
For i = 1 To .RecordCount
.Delete
.Update
.MoveNext
If .EOF Then Exit For
Next
End With
if not .eof then
.movefirst
.moveend
else
exit sub
end if
.movefirst
For i = 1 To .RecordCount
.Delete
.Update
.MoveNext
If .EOF Then Exit For
Next
End With
必须将纪录movefirst。
根据你的程序
...
.MoveNext
If .EOF Then Exit For
...
可以知道进入循环时肯定已经eof了。
MyConnection.execute "DELETE FROM mydatabase"
on error resume next
With DelRs
For i = 1 To .RecordCount .movefirst
.Delete
.Update
Next
End With
on error goto 0
用command挺好的
只用一个句子
dim cmm as new adodb.command
set cmm.ActiveConnection=myconnectioncmm.CommandText="delete form tablename"
cmm.execute
set cmm=nothing