dbgrid的数据来源于与其关联的TTable或TQuery,行数可以用TTable或TQuery的RecordCount属性获得。同理移动当前记录可以用FindKey、FindNearest等方法。

解决方案 »

  1.   

    recno属性 或者 tdrawgrid(dbgrid1).col = ? tdrawgrid(dbgrid1).row = ?
      

  2.   

    recordCount不准确,其结果可以通过以下代码得到
    var i:integer;
    with dbgrid.dataSourse.dataset do
    begin
      first;
      i:=0;
      while not eof do begin
        i:=i+1;
        next;
      end;
    end;
    记得使用上面代码时要保存当前记录的书签,以便需要时恢复.定位记录可以使用locate方法(borland推荐使用);在tdataSet的帮助中有详细说明和实例.
      

  3.   

    不要胡说,对于PardonX数据库和SQLServer等大型数据库,recordCount是准确的