增加一个字段id,利用它来排序。当按下按钮的时候来改变纪录的id值,刷新纪录就可以改表纪录在表中的顺序了。

解决方案 »

  1.   

    dbgrid1.keydown(...)
    begin
      case key of
        vk_down:
           begin
             if not dbgrid1.datasource.dataset.eof then 
             dbgrid1.datasource.dataset.next;
           end;
        vk_up :
           begin
             if not dbgrid1.datasource.dataset.bof  then 
             //向上移动
           end;
      end;
    end;
      

  2.   

    while not table1.eof do  下移
    begin
    table1.next;
    end;while not table1.Bof do  上移
    begin
    table1.prior;
    end;
      

  3.   

    这样好象你必须要写sql语句把第八条和地七条的记录换一下,再按一下把第七条和第六条的记录换一下。是不是可以实现啊!