0
我需要幫助解決我的代碼...(德爾福)query.next不工作
我嘗試用這個代碼
Adoquery.close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from schedule where every like ''%5%''');
ADOQuery1.Open;
if not ADOQuery1.Eof then
begin
ShowMessage('hallo '+ADOQuery1.fieldbyname('remark').AsString);
ADOQuery1.Next;
end
Else
Begin
end;
我對結果2個數據記錄建立一些應用程序,但爲什麼只有一條評論顯示?
我嘗試跟蹤它並在ADOQuery1.next中發現問題。在我的應用程序讀取ADOQuery.next後,光標跳轉到
end;不能返回到
if not ADOQuery1.Eof then。
我的代碼出現任何錯誤?
你應該使用'while'像'而不是ADOQuery1.Eof do' – RRUZ
另外,你也應該讓你的光標是第一個記錄遍歷這樣'ADOQuery1前。首先;' – Fero
@ Fero68,是的,這是一個很好的習慣,但在打開'Open'後立即就不必要了。 – MartynA