with DataSource.DataSet do
    begin
      case Index of
        nbPrior: Prior;
        nbNext: Next;
        nbFirst: First;
        nbLast: Last;
        nbInsert: Insert;
        nbEdit: Edit;
        nbCancel: Cancel;
        nbPost: Post;
        nbRefresh: Refresh;
        nbDelete:
          if not FConfirmDelete or
            (MessageDlg(SDeleteRecordQuestion, mtConfirmation,
            mbOKCancel, 0) <> idCancel) then Delete;
      end;
    end;

解决方案 »

  1.   

    table1.first;
    table1.prior;
    table1.next;
    table1.last;
    table1.append;
    table1.post;if messagedlg('您真的要删除这一条吗?',mtconfirmation,[mbyes,mbno],0)=mryes then
    table1.delete;
        
      

  2.   

    请问chechy(chechy)
    以上代码加在哪里?
    我想要各个按钮的点击代码,类似于
    {procedure TForm7.BitBtn4Click(Sender: TObject);
    begin
    adotable1.close;
    adotable1.open;
    adotable1.first;
    end; 
      

  3.   

    在Form上放一个TActionList,在里面添加Standard Action->DataSet里的TDataSetFirst、TDataSetNext、TDataSetDelete等Action,然后把它们的DataSource指向DBGrid关联的DataSource,修改Caption等属性。最后把各个Button的Action与这些标准Action关联即可!
    至于删除时的提示,则可以在DBGrid实际关联的DataSet的BeforeDelete里这样写——
      if Application.MessageBox('您真的要删除这一条吗?', '警告',
        MB_YESNO + MB_ICONWARNING + MB_DEFBUTTON2) = IDNO then Abort;搞定,收工!
      

  4.   

    zjwpanhp(php) 
    你的代码根本没有指针位置判断,点一次就不行了!
      

  5.   

    以上代码是从DBCtrls单元中的TDBNavigator.BtnClick(Index: TNavigateBtn);拷贝的。