vb编程 DataGrid控件删除一条数据

If MsgBox("确定删除该条数据", 1, "警告") = vbOK Then
Adodc1.Recordset.Delete '删除记录
Adodc1.Recordset.Update '更新数据表
End If
提示“行句柄引用了一个已被删除的行或被标识为删除的行”
改成这样
If MsgBox("确定删除该条数据", 1, "警告") = vbOK Then
Adodc1.Recordset.Delete '删除记录
Adodc1.Recordser.Movenext
Adodc1.Recordset.Update '更新数据表
End If
仍然有这样的提示,请问怎么处理不提示,实在不行告诉我“On error resume next”放哪里
代码是我手打的,程序中没问题!
谢谢大家,自己解决了。

第1个回答  2013-12-21
这个问题不需要弄得这么复杂,DataGrid右键里面有个属性值,允许删除,勾选之后,再在DataGrid的单击事件下,加上代码,DataGrid1.SelBookmarks.add DataGrid1.Bookmark,允许之后,选择Datax中的一条属性值,直接按Delete键删除,数据表中的这条记录值也自动删除了!
第2个回答  2013-12-23
dim X As Integer
X=MsgBox("确定删除该条数据", 1, "警告")
if X=1 then
Adodc1.Recordset.Delete '删除记录 Adodc1.Recordser.Movenext Adodc1.Recordset.Update '更新数据表End If
On error resume next追问

你的和我原来的一模一样呢。

本回答被提问者采纳
第3个回答  2013-12-21
Dim CXZ As Integer
CXZ=MsgBox("确定删除该条数据?", 33, "确认删除!")
If CXZ = 1 Then Adodc1.Recordset.Delete '删除记录 End If就可以了。
相似回答