I
Imfish
Unregistered / Unconfirmed
GUEST, unregistred user!
//下面是一组循环将最新数据从源数据中读出并放入本地数据源中
repeat
//先放表list_b数据
localquery.append;
for i:=0 to 6 do
begin
localquery.Fields[i+1].Asstring:=sourcequery.fields.asstring;
end;
//根据编号放入表ysj1中的数据,这些语句必须放在这里
bhint:=moduleform.sourcequery.FieldByName('bh').asinteger;
querytemp.Close;
querytemp.SQL.Clear;
querytemp.SQL.Add('select * from ysjl where bh=:bh');
querytemp.Parameters.ParamByName('bh').value:=bhint;
querytemp.open;
repeat
//因为每个编号对应许多的记录,所以又引入这个循环
querytemp1.append;
querytemp1.fieldbyname('ZM').asstring:=rstation;
for j:=0 to 11 do
begin
querytemp1.Fields[j+2].Asstring:=querytemp.fields[j+1].asstring;
end;
querytemp.Next;
until querytemp.eof=true;
sourcequery.next;
until sourcequery.eof=true;
我用上面的语句导入主表120条记录,从表4000条记录共用了5分钟,请DFW们帮忙指点,谢谢
repeat
//先放表list_b数据
localquery.append;
for i:=0 to 6 do
begin
localquery.Fields[i+1].Asstring:=sourcequery.fields.asstring;
end;
//根据编号放入表ysj1中的数据,这些语句必须放在这里
bhint:=moduleform.sourcequery.FieldByName('bh').asinteger;
querytemp.Close;
querytemp.SQL.Clear;
querytemp.SQL.Add('select * from ysjl where bh=:bh');
querytemp.Parameters.ParamByName('bh').value:=bhint;
querytemp.open;
repeat
//因为每个编号对应许多的记录,所以又引入这个循环
querytemp1.append;
querytemp1.fieldbyname('ZM').asstring:=rstation;
for j:=0 to 11 do
begin
querytemp1.Fields[j+2].Asstring:=querytemp.fields[j+1].asstring;
end;
querytemp.Next;
until querytemp.eof=true;
sourcequery.next;
until sourcequery.eof=true;
我用上面的语句导入主表120条记录,从表4000条记录共用了5分钟,请DFW们帮忙指点,谢谢