为什么我把query1.active:=true;后query1.recordcount正是我要查询的纪录的正确的数目,可是query1.recno确总是等于-1,我用了query1.first这个语句可query1.recno仍然为-1这是怎么回事啊?

解决方案 »

  1.   

    是对的,请看
    Examine RecNo to determine the record number of the current record in the dataset. Applications might use this property with RecordCount to iterate through all the records in a dataset, though typically record iteration is handled with calls to First, Last, MoveBy, Next, and Prior.Note: If accessing Paradox tables, RecNo can be set to a specific record number to position the cursor on that record.
    只有Paradox表才能起作用,其他数据库就不行了
      

  2.   

    query1.recno对sqlserver无效,只有Paradox表才能起作用
      

  3.   

    我是使用的sql server数据库,那如果我想查询的话应该怎么做呢?我打算把查询结果写在paradox数据表中,如果recno一直是-1那不就没法写进去了吗?那怎么能实现查询的功能呢
    多谢大虾
      

  4.   

    QUERY的RECNO是有问题,不要用它!
    TABLE的RECNO还好一些!
      

  5.   

    用循环!Query1.Open;
    //Query1.First;
    if Not Query1.IsEmpty then
    While Not Query1.Eof do
    begin
      //写数据到PARADOX
      //PANQuery1.Insert;
      //PANQuery1.FieldByName('ID').Asstring := Query1.FieldByName('id').ASstring;
      //PANQuery1.FieldByName('Name').Asstring := Query1.FieldByName('Name').ASstring;
      //PANQuery1.APPLYUPDATES;
      //PANQuery1.CommitUpdates;
      Query1.Next;
    end;
      

  6.   

    我是想把query里面的内容保存,输出,怎么搞啊?