我用ADOQuery连数据库,
我想从第一条记录开始读取到最后一条记录,
为什么我用
while not ADOQuery.Recordset.EOF do
      ADOQuery.Fields.Fields[1].AsString的数据永远是第一条记录的
      ADOQuery.RecNo 也永远是1
      ADOQuery.Recordset.MoveNext ;
end;请问如何解决,我试过用ADOQuery1.Recordset.Fields.Item[1].Value,不过一但该字段还没赋值,就会出错,用ADOQuery.Fields.Fields[1].IsNull又判断不了,就高手帮助

解决方案 »

  1.   

    应该用:
    ADOQuery.Next;
    来代替:
    ADOQuery.RecordSet.MoveNext;
      

  2.   

    for i:= 0 to aduQuery.recordset.fields.count-1 do 
    begin
    你需要的代码
    end;
      

  3.   

    ADOQuery.recordcount<1 then exit;
    ADOQuery.first;
    while not ADOQuery.EOF do
          ADOQuery.Fields.Fields[1].AsString的数据永远是第一条记录的
          ADOQuery.RecNo 也永远是1
          ADOQuery.next;
    end;
      

  4.   

    ADOQuery.Recordset.MoveNext ;改成ADOQuery.next;
      

  5.   

    ADOQuery.Recordset.MoveNext ;是移动的recordset的记录号,不是查询出来的记录号
    所以用adoquery.next;
    如果字段附值用
    while  not(adoquery1.Eof)  do
     begin
       adotable1.Open;
       adotable1.edit;
       adotable1.Insert;
       for j:=0 to adotable1.FieldCount-1 do
       begin
         adotable1.Fields[j]:=adoquery1.Fields[j+1];
       end;
       adotable1.Post ;
       adoquery1.Next;
       application.ProcessMessages ;
       inc(i)  ;
       gauge1.Progress:=i ;
       edit1.Text :=inttostr(i);
     end;
      

  6.   

    adoquery1.next
     not adoquery1.eof