S
sun2001win
Unregistered / Unconfirmed
GUEST, unregistred user!
小弟现在想把学校这栏的查询该成,当输入为"学校一,学校二,学校三时,。。。。"所有的‘学校一,学校二,学校三时,。。。。’的学生信息都显示出来。小弟以前的源码是:
procedure Tfm_by.bsSkinSpeedButton8Click(Sender: TObject);
var
sqlstr:string;
ss:string;
p:integer;
school:string;
begin
{if (bsskincombobox1.Text<>'初中包月') and (bsskincombobox1.Text<>'高中包月') then
begin
showmessage('请选择包月类型!');
exit;
end;}
with dd.by do
begin
sqlstr:='select u_name as 姓名,tel as 手机号,adrees as 居住地,school as 学校,s_type as 业务类型,t_ding as 定制时间,t_jf as 计费时间,b_sy as 试用,b_qx as 取消 from sm_load where b_sy=:a and b_qx=:i';
if bsskinedit1.Text <>'' then sqlstr:=sqlstr+' and u_name=:b';
if bsskinedit2.Text <>'' then sqlstr:=sqlstr+' and tel=:c';
if bsskinedit3.Text <>'' then sqlstr:=sqlstr+' and adrees=:d';
if bsskinedit4.Text<>'' then sqlstr:=sqlstr+'and (school in :e)';
if bsskincombobox1.Text <>'' then sqlstr:=sqlstr+' and s_type=:f';
if (trim(bsskindateedit1.Text) <>'- -') and (trim(bsskindateedit1.Text) <>'/ /') then sqlstr:=sqlstr+' and t_ding>:g';
if (trim(bsskindateedit2.Text) <>'- -') and (trim(bsskindateedit2.Text) <>'/ /') then sqlstr:=sqlstr+' and t_jf>:h';
close;
sql.Clear;
sql.Add(sqlstr);
parambyname('a').AsBoolean:=bsskincheckradiobox1.Checked;
parambyname('i').AsBoolean:=bsskincheckradiobox2.Checked;
if pos(':b',sqlstr)>0 then parambyname('b').AsString:=bsskinedit1.Text;
if pos(':c',sqlstr)>0 then parambyname('c').AsString:=bsskinedit2.Text;
if pos(':d',sqlstr)>0 then parambyname('d').AsString:=bsskinedit3.Text;
if pos(':e',sqlstr)>0 then
begin
ss:=bsskinedit4.Text;
p:=pos(',',ss);
school:='(';
while pos(',',ss)>0 do
begin
school:=school+#39+copy(ss,1,pos(',',ss)-1)+#39+',';
ss:=copy(ss,pos(',',ss)+1,Length(ss)-pos(',',ss));
end;
school:=school+#39+ss+#39;
parambyname('e').AsString:=school;
end;
if pos(':f',sqlstr)>0 then parambyname('f').AsString:=bsskincombobox1.Text;
if pos(':g',sqlstr)>0 then parambyname('g').AsDateTime:=bsskindateedit1.Date;
if pos(':h',sqlstr)>0 then parambyname('h').AsDateTime:=bsskindateedit2.Date;
open;
end;
if bsskincombobox1.Text='初中包月' then bytype:=czby_type;
if bsskincombobox1.Text='高中包月' then bytype:=gzby_type;
bsskinspeedbutton9.Enabled:=true;
end;
他老是报关键字'i'不知道,希望给出答案
procedure Tfm_by.bsSkinSpeedButton8Click(Sender: TObject);
var
sqlstr:string;
ss:string;
p:integer;
school:string;
begin
{if (bsskincombobox1.Text<>'初中包月') and (bsskincombobox1.Text<>'高中包月') then
begin
showmessage('请选择包月类型!');
exit;
end;}
with dd.by do
begin
sqlstr:='select u_name as 姓名,tel as 手机号,adrees as 居住地,school as 学校,s_type as 业务类型,t_ding as 定制时间,t_jf as 计费时间,b_sy as 试用,b_qx as 取消 from sm_load where b_sy=:a and b_qx=:i';
if bsskinedit1.Text <>'' then sqlstr:=sqlstr+' and u_name=:b';
if bsskinedit2.Text <>'' then sqlstr:=sqlstr+' and tel=:c';
if bsskinedit3.Text <>'' then sqlstr:=sqlstr+' and adrees=:d';
if bsskinedit4.Text<>'' then sqlstr:=sqlstr+'and (school in :e)';
if bsskincombobox1.Text <>'' then sqlstr:=sqlstr+' and s_type=:f';
if (trim(bsskindateedit1.Text) <>'- -') and (trim(bsskindateedit1.Text) <>'/ /') then sqlstr:=sqlstr+' and t_ding>:g';
if (trim(bsskindateedit2.Text) <>'- -') and (trim(bsskindateedit2.Text) <>'/ /') then sqlstr:=sqlstr+' and t_jf>:h';
close;
sql.Clear;
sql.Add(sqlstr);
parambyname('a').AsBoolean:=bsskincheckradiobox1.Checked;
parambyname('i').AsBoolean:=bsskincheckradiobox2.Checked;
if pos(':b',sqlstr)>0 then parambyname('b').AsString:=bsskinedit1.Text;
if pos(':c',sqlstr)>0 then parambyname('c').AsString:=bsskinedit2.Text;
if pos(':d',sqlstr)>0 then parambyname('d').AsString:=bsskinedit3.Text;
if pos(':e',sqlstr)>0 then
begin
ss:=bsskinedit4.Text;
p:=pos(',',ss);
school:='(';
while pos(',',ss)>0 do
begin
school:=school+#39+copy(ss,1,pos(',',ss)-1)+#39+',';
ss:=copy(ss,pos(',',ss)+1,Length(ss)-pos(',',ss));
end;
school:=school+#39+ss+#39;
parambyname('e').AsString:=school;
end;
if pos(':f',sqlstr)>0 then parambyname('f').AsString:=bsskincombobox1.Text;
if pos(':g',sqlstr)>0 then parambyname('g').AsDateTime:=bsskindateedit1.Date;
if pos(':h',sqlstr)>0 then parambyname('h').AsDateTime:=bsskindateedit2.Date;
open;
end;
if bsskincombobox1.Text='初中包月' then bytype:=czby_type;
if bsskincombobox1.Text='高中包月' then bytype:=gzby_type;
bsskinspeedbutton9.Enabled:=true;
end;
他老是报关键字'i'不知道,希望给出答案