我有一个有20000条记录的表,其中有一个“编号”的string字段
我想:
让“编号”字段重新按“00001”-“20000”的顺序写入数据。
with QYtemp do
begin
...
while not eof do
begin
edit;
....
fieldbyname('编号').asstring:=....
post;
next;
end;
这样做的话,速度慢的要死。
有什么办法用 update from的形式实现?
...全文
17422打赏收藏
如何按这样的要求快速更新数据???
我有一个有20000条记录的表,其中有一个“编号”的string字段 我想: 让“编号”字段重新按“00001”-“20000”的顺序写入数据。 with QYtemp do begin ... while not eof do begin edit; .... fieldbyname('编号').asstring:=.... post; next; end; 这样做的话,速度慢的要死。 有什么办法用 update from的形式实现?
with QYtemp do
begin
DisableControl;
...
while not eof do
begin
edit;
....
fieldbyname('编号').asstring:=....
post;
next;
end;
EnableControl;
========================
在前后加这两个就会大加快速度
很简单,可以用批处理嘛以adotable为例
with adotable1 do
begin
close;
LockType:=ltBatchOptimistic;
CursorType:=ctkeyset;
while not eof do
begin
append;
fieldbyname('编号').asstring:=....
next;
end;
label1.Caption:='共导入 '+inttostr(RecordCount)+' 条记录'; //更新耗时,显示记录数
label1.Refresh;
UpdateBatch;
end;