在循环操作数据库时,跳出当前循环遇到问题。下面的DkLowTs变量值是30,查询出来ts字段中有31 32 29 28 31,在执行了29的时候,使用continue,之后的 就都不会再执行了。
with ADOQuery1 do
begin
first;
for i := 0 to RecordCount-1 do
begin ts:=fieldbyname('ts').AsInteger; if StrToInt(DkLowTs)>ts then continue; //用了 continue;来判断条件后,总个过程都会跳出。
…… 后面是插入数据库的代码
Next;
end;
end;
with ADOQuery1 do
begin
first;
for i := 0 to RecordCount-1 do
begin ts:=fieldbyname('ts').AsInteger; if StrToInt(DkLowTs)>ts then continue; //用了 continue;来判断条件后,总个过程都会跳出。
…… 后面是插入数据库的代码
Next;
end;
end;
begin
next;
continue;
end;不加next,就会死循环。
我代码中不是有条件么?if StrToInt(DkLowTs)>ts then continue; //用了 continue;来判断条件后,总个过程都会跳出。