L
linkfly
Unregistered / Unconfirmed
GUEST, unregistred user!
有一个Paradox的本地数据库,现要修改其中的每一条记录,记录数约为9000条。
程序如下:
procedure TForm1.Button1Click(Sender: TObject);
var
i : integer;
begin
for i := 1 to 9000 do
begin
screen.Cursor := crHourglass;
with query1 do
begin
close;
sql.clear;
sql.add('update daycheck set ?WorkTime1 = :sbdk, Worktime2 =:xbdk, WorkTime3 =:jbsb, WorkTime4 =:jbxb,');
sql.add(' WorkTime5 =:lcdk, WorkTime6 = :hcdk where (Date = :riqi) and (ID_no= :IDhao)');
paramByName('sbdk').AsDateTime := strtotime('12:22');
paramByName('xbdk').AsDateTime := strtotime('12:22');
paramByName('jbsb').AsDateTime := strtotime('12:22');
paramByName('jbxb').AsDateTime := strtotime('12:22');
paramByName('lcdk').AsDateTime := strtotime('12:22');
paramByName('hcdk').AsDateTime := strtotime('12:22');
paramByName('IDhao').Asstring := '0090';
paramByName('riqi').AsDatetime := strtodate('1999-12-31');
execsql;
end;
end;
screen.Cursor := crDefault;
end;
程序执行大约要20分钟,并且程序的界面(Form)好象死机一样,不知大家有没有什么方法。可以加快程序写库
的时间,用Cacheupdate如果操作?希望能讲得详细一点。给50分。
程序如下:
procedure TForm1.Button1Click(Sender: TObject);
var
i : integer;
begin
for i := 1 to 9000 do
begin
screen.Cursor := crHourglass;
with query1 do
begin
close;
sql.clear;
sql.add('update daycheck set ?WorkTime1 = :sbdk, Worktime2 =:xbdk, WorkTime3 =:jbsb, WorkTime4 =:jbxb,');
sql.add(' WorkTime5 =:lcdk, WorkTime6 = :hcdk where (Date = :riqi) and (ID_no= :IDhao)');
paramByName('sbdk').AsDateTime := strtotime('12:22');
paramByName('xbdk').AsDateTime := strtotime('12:22');
paramByName('jbsb').AsDateTime := strtotime('12:22');
paramByName('jbxb').AsDateTime := strtotime('12:22');
paramByName('lcdk').AsDateTime := strtotime('12:22');
paramByName('hcdk').AsDateTime := strtotime('12:22');
paramByName('IDhao').Asstring := '0090';
paramByName('riqi').AsDatetime := strtodate('1999-12-31');
execsql;
end;
end;
screen.Cursor := crDefault;
end;
程序执行大约要20分钟,并且程序的界面(Form)好象死机一样,不知大家有没有什么方法。可以加快程序写库
的时间,用Cacheupdate如果操作?希望能讲得详细一点。给50分。