G
gojohnnywong
Unregistered / Unconfirmed
GUEST, unregistred user!
以下语句是将listbox里的记录批量的插入到表里,当listbox的记录数达到一千几百的时候,程序的处理速度非常慢,好像将系统的资源都用尽了,其他的应用程序(例如打开网页等都很慢),请问有什么方法可以提高程序的处理速度? 代码如下:
opensql:='select mxlb as lb from T_SYS_CSMX where mxmc='''+trim(combobox2.Text)+'''';
try
if pubquery.Active then pubquery.Close;
pubquery:=openquery(opensql,psession); //执行sql语句
except
showmessage('操作失败!');
end;
ii:=pubquery.FieldByName('lb').AsVariant;
for i := 0 to ListBox1.Count - 1 do
begin
exsql:= 'Insert into T_TMP_TAB1(YJTM,SJJ,FFRQ,BC,JSZBH,FDCZY) Values('+QuotedStr(ListBox1.Items)+','''+inttostr(ii)+''',to_char(sysdate,'+''''+'YYYY-MM-DD'+''''+'),'''+trim(Edit1.Text)+''','''+trim(Edit16.Text)+''','''+xtcs.srybh+''')';
try
execsql(exsql,psession);//执行sql语句
except
showmessage('操作失败!');
end;
end;
opensql:='select mxlb as lb from T_SYS_CSMX where mxmc='''+trim(combobox2.Text)+'''';
try
if pubquery.Active then pubquery.Close;
pubquery:=openquery(opensql,psession); //执行sql语句
except
showmessage('操作失败!');
end;
ii:=pubquery.FieldByName('lb').AsVariant;
for i := 0 to ListBox1.Count - 1 do
begin
exsql:= 'Insert into T_TMP_TAB1(YJTM,SJJ,FFRQ,BC,JSZBH,FDCZY) Values('+QuotedStr(ListBox1.Items)+','''+inttostr(ii)+''',to_char(sysdate,'+''''+'YYYY-MM-DD'+''''+'),'''+trim(Edit1.Text)+''','''+trim(Edit16.Text)+''','''+xtcs.srybh+''')';
try
execsql(exsql,psession);//执行sql语句
except
showmessage('操作失败!');
end;
end;