我用的ADODataSet与数据源连接的,但是在按下DBNavigator的ADD按钮时总是不能按照序号的
顺序在记录集的末尾添加这最后一个记录,我想问下通过ADODataSet那个事件实现在记录集末尾添加新
纪录,谢谢!

解决方案 »

  1.   

    自己用Append不就OK了,DBNavigator的ADD按钮是Insert
      

  2.   

    把DBNavigator的增加按钮中的代码写成append,并且屏蔽dbnavigator原按钮中的代码就可以了,
      

  3.   

    经测试,可以实现你的要求
    procedure TForm1.DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
    begin
    adodataset1.Append;
    end;
      

  4.   

    敢问2楼大虾:
        
                “屏蔽dbnavigator原按钮中的代码”怎样实现?
      

  5.   

    屏蔽操作
    procedure TFrmNode.Navigator1Click(Sender: TObject;
      Button: TNavigateBtn);
    begin
            case Button of
            nbDelete:begin
                     if MessageDlg('确认删除?',mtConfirmation,[mbYes,mbNo],1)=mrYes then
                     DMRemote.DataModule1.CDSNode.ApplyUpdates(0)
                     else
                     DMRemote.DataModule1.CDSNode.CancelUpdates;
                     end;
            nbPost:begin
                   DMRemote.DataModule1.CDSNode.Edit;
                   DMRemote.DataModule1.CDSNode.ApplyUpdates(0);
                   end;
            end;
    end;
      

  6.   

    添加按钮为nbInsert
    其他的为
    First nbFirst Go to the first record
    Prior nbPrior Go to the previous record
    Next nbNext Go to the next record
    Last nbLast Go to the last record
    Insert nbInsert Insert a blank record
    Delete nbDelete Delete the current record
    Edit nbEdit Permit users to edit the current record
    Post nbPost Post the current record
    Cancel nbCancel Cancel the current edit
    Refresh nbRefresh