var
i    : integer;
query : tadoquery;
begin
query:=tadoquery.create(nil);
query.Connection :=adoconn1;
query.sql.text:=edit5.text;
query.open;
query.first;
while not query.Eof do begin
  for i:=0 to query.recordcount-1 do begin
        ..........
  end;  query.Next;
end;
query.close; 
query.free;

解决方案 »

  1.   

    問題依舊,說什么bof or eof 有一個為真,此處需要數據!????
      

  2.   

    bof or eof这是老问题了,ADO的bug,要装两个补丁
      

  3.   

    謝謝樓上兩位,我解決了,原來需要 query.first 一下,才可以 close,free;!
      

  4.   

    我在5中碰到过,如果query的recordcount为0,就不能close,说什么eof之类的,在6中试却可以。
      

  5.   

    补丁下载地址
    http://www.pchome.net/dl/delphi.htm
      

  6.   

    可能是碰巧了,你仔细看看你的代码,query.fieldcount这是字段总数,不是记录总数
    应该用记录总数recordcount
      for i:=0 to query.fieldcount-1 do begin
      

  7.   

    看一下我的程序先
    http://210.12.86.10/chinaatn.exe