table1.First while not Table1.Eof do begin //do you stuff table1.Next; end;
with table1 do begin open; while not table1.eof then begin 处理记录; next; end; end; table1.close;当然你还可以用计数器来实现,方法是这样的:var a,b:integer; with table1 do begin open; a:=1; b:=recordcount;{记录总数} while a<=b then begin 处理记录; next; a:=a+1; end; end; table1.close; 不过这样用的话,就有些对不起Borland的工程师了,人家好好的 .EOF(END OF FILE)属性不用? 以上计数器方法在以下情况下可能无效: 1。 处理过程中增加记录 2。 处理过程中删除记录 3。 这个世界黑白颠倒的时候
while not Table1.Eof do
begin
//do you stuff table1.Next;
end;
begin
open;
while not table1.eof then
begin
处理记录;
next;
end;
end;
table1.close;当然你还可以用计数器来实现,方法是这样的:var a,b:integer;
with table1 do
begin
open;
a:=1;
b:=recordcount;{记录总数}
while a<=b then
begin
处理记录;
next;
a:=a+1;
end;
end;
table1.close;
不过这样用的话,就有些对不起Borland的工程师了,人家好好的 .EOF(END OF FILE)属性不用?
以上计数器方法在以下情况下可能无效:
1。 处理过程中增加记录
2。 处理过程中删除记录
3。 这个世界黑白颠倒的时候