我做了个程序将edit 框里输入的条形码添加到一个listbox里,录完后将listbox里存储的条形码批量的插入数据库。但当从edit框输入到listbox的条形码达到一千多条时,处理速度慢得不能接受,请问有什么方法可以提高速度?
解决方案 »
- 一直孤陋寡闻了,散分
- 用RAVE打印自定义纸张报表,急急,,在线等
- dxDBGrid能否做成每行的颜色交替显示?
- 谁有 陈宽达的<delphi深度历险>这本书的源码
- 请教!如何更改第3方软件上某个控件的外观?
- 用过DX控件的朋友请给指点一下!!!
- 取得汉字的点阵
- 大虾们!帮忙呀?谁能给我详细介绍一下delphi ado 的 ERROR集的用法-----急用呀。。。。。。。。。。。。。。。。。。
- 求助如何把图片存入到access里边?有否输入汉字自动转化成拼音的控件?多谢....
- Netants是怎样将图标放到IE工具栏去的?需要GUID吗?
- 如何才能在Fasteport v3.x中画表格线,从页头一直画到页脚,没记录也画满?
- 怎么我的鼠标停放在delphi7的控件上没有提示信息?
procedure Tfrminput.Button5Click(Sender: TObject);
var
opensql:string;
i:integer;
begin
//加条码位数及字符判断
if not ((length(edit2.Text)=13) or (length(edit2.Text)=11)) then
begin
showmessage('条形码的位数不正确,请检查!');
edit2.clear;
edit2.SetFocus;
abort;
end;
//检查数据库中是否有此条码的资料,如果有则不录入
begin
opensql:='select * from t_sys_tab1 where yjtm='''+UpperCase(edit2.Text)+''' and yjzt<>5 and ffrq is not null';
try //
if pubquery.Active then pubquery.Close;
pubquery:=openquery(opensql,psession); //这里执行sql语句
except
showmessage('操作失败!');
end;
if pubquery.RecordCount=0 then
begin
opensql:='select * from t_sys_tab2 where yjtm='''+UpperCase(edit2.Text)+''' and yjzt<>5 and ffrq is not null';
try //
if pubquery.Active then pubquery.Close;
pubquery:=openquery(opensql,psession); //这里执行sql语句
except
showmessage('操作失败!');
end;
if pubquery.RecordCount=0 then
begin
opensql:='select * from t_sys_tab3 where yjtm='''+UpperCase(edit2.Text)+''' and yjzt<>5 and ffrq is not null';
try //
if pubquery.Active then pubquery.Close;
pubquery:=openquery(opensql,psession); //这里执行sql语句
except
showmessage('操作失败!');
end;
if pubquery.RecordCount=0 then
begin //插入到listbox里
//---------
for i:=0 to Listbox1.Items.Count do
begin
if ListBox1.Items.Indexof(edit2.Text)<0 then
begin
listbox1.Items.Add(UpperCase(edit2.Text));
n:=n+1;
label4.Caption:=inttostr(n);
edit2.Clear;
end
else
edit2.Clear;
edit2.SetFocus;
abort; end;
//-------------
end
else
begin
showmessage('该条码已存在,请勿重复录入!');
edit2.clear;
edit2.SetFocus;
abort;
end;
end
else
begin
showmessage('该条码已存在,请勿重复录入!');
edit2.clear;
edit2.SetFocus;
abort;
end;
end
else
begin
showmessage('该条码已存在,请勿重复录入!');
edit2.clear;
edit2.SetFocus;
abort;
end;
end;end;
for i:=0 to Listbox1.Items.Count do
begin
if ListBox1.Items.Indexof(edit2.Text)<0 then
begin
listbox1.Items.Add(UpperCase(edit2.Text));
n:=n+1;
label4.Caption:=inttostr(n);
edit2.Clear;
end
else
edit2.Clear;
edit2.SetFocus;
abort;