按照以下方式排序,数据显示是正确的,但是用fieldbyname('bjmc').asinteger:=TFakeGrid(DBGrid1).Row 取对应的行号是却出现错误,请问是为什么。
 在DBGRID1里的 错误摘录显示如下:
字段     
      ZF    BJMC
取值
      123     1
      100     2
        98    3
        92    3
        88    3
        75    3
        62    3
        56    3
原代码如下
 with  dmmain.adoqueryxx  do 
                    sql.Add('select *  from  '+ mtablename+'  where left(xh,6)='+quotedstr(bjdm));
                    sql.Add('  ORDER BY  zf  desc ' );
                    open;
                    first;
                    while  not eof  do
                      begin
                       edit;
                       fieldbyname('bjmc').asinteger:=TFakeGrid(DBGrid1).Row;
                       showmessage(inttostr(TFakeGrid(DBGrid1).Row)+inttostr(fieldbyname('zf').asinteger));
                       post;
                       next;
                      end;
                    
     end;