您的位置首页百科快答

关于DELPHI的一些问题

关于DELPHI的一些问题

的有关信息介绍如下:

关于DELPHI的一些问题

一)实现模糊查询的代码,自己看下,希望对你有帮助!

var

cName1,poNo1,poType1,moldNo1,quoNo1,cloNO1,jobNo1,qDate1:string;

begin

if length(trim(cName.Text ))=0 then

cName1:='1=1'

else

cName1:='客户名称 like '+quotedstr(cName.Text );

if length(trim(poNo.Text ))=0 then

poNo1:='1=1'

else

poNo1:='订单号码 like '+quotedstr(poNo.Text );

if length(trim(poType.Text ))=0 then

poType1:='1=1'

else

poType1:='订单类别 like '+quotedstr(poType.Text );

if length(trim(moldNo.Text ))=0 then

moldNo1:='1=1'

else

moldNo1:='本司模号 like '+quotedstr(moldNo.Text );

if length(trim(quoNo.Text ))=0 then

quoNo1:='1=1'

else

quoNo1:='报价单号 like '+quotedstr(quoNo.Text );

if length(trim(cloNo.Text ))=0 then

cloNo1:='1=1'

else

cloNo1:='成交通知书 like '+quotedstr(cloNo.Text );

if length(trim(jobNo.Text ))=0 then

jobNo1:='1=1'

else

jobNo1:='JobOrderNo like '+quotedstr(jobNo.Text );

if length(trim(sDate.Text ))=0 then

qDate1:='1=1'

else

qDate1:='成交日期 >= '+quotedstr(trim(sDate.Text))+' and 成交日期 <= '+quotedstr(trim(eDate.Text));

with adoquery1 do

begin

close;

sql.Clear ;

sql.Add('select * from tb模具订单资料 where '+cName1+' and '+poNo1+' and '+poType1+' and '+moldNo1+' and '+quoNo1+' and '+cloNo1+' and '+JobNo1+' and '+qDate1);

open;

end;

二)Combobox

cName.Clear ;

with frm_main.adols do

begin

close;

sql.Clear ;

sql.Add('select 客户名称 from tb客户基本资料 order by 客户名称');

open;

end;

if frm_main.adols.RecordCount >0 then

while not frm_main.adols.Eof do

begin

cName.Items.Add(frm_main.adols.fieldbyname('客户名称').Value );

frm_main.adols.Next ;

end;