现想更新数据库的某些字段,用TTable 来过滤,然后更新,对批量处理(10万条),速度很慢,要1小时左右.
请问哪位有经验,用哪个控件,with table1 do
begin
for i:= 1 to 100000 do
begin
Active := false;
Filter := 'id = ' + id0;
Filtered := True;
Active := true;
edit; fieldbyname('name').Asstring := 'name';
post;
end;
end;thanks very much!(本人分不多,抱歉)
请问哪位有经验,用哪个控件,with table1 do
begin
for i:= 1 to 100000 do
begin
Active := false;
Filter := 'id = ' + id0;
Filtered := True;
Active := true;
edit; fieldbyname('name').Asstring := 'name';
post;
end;
end;thanks very much!(本人分不多,抱歉)
1#楼正解。 用循环方式是效率最低的,改用Update <表名> set .... where <条件>
用循环是最不可取的方法,最科学的方法应该使用SQL语句或者生成SQL语句 再去执行 效率会大大提高!
其实用写SQL语句或者储存过程进行处理.