delphi 右键删除dbgrid行

Delphi DBGrid右键删除行并提交至数据库.
在form上添加,控件TPopupMenu,并指定右键名称:删行

2.编写删除语句:   

    If ADOQuery1.State in [dsEdit, dsInsert] then ADOQuery1.Post;
    If ADOQuery1.RecordCount <> 0 then ADOQuery1.Delete;

3.把dbgrid的PopupMenu属性,设置成刚刚添加的控件TPopupMenu。

4.编译,运行

posted on 2017-09-17 23:18  癫狂编程  阅读(848)  评论(0编辑  收藏  举报

导航

好的代码像粥一样,都是用时间熬出来的