if kehu_xm<>'' then
begin
SQL.Add('and kehu_xm like :kehu_xm');
Parameters.ParamByName('kehu_xm').Value:='%'+kehu_xm+'%';
end; 我想在这查询中在多加一个字段kehu_lp(联系人拼音)改如何修改,kehu_xm(联系人) 也就是当向参数kehu_xm 付上‘张三’或'zs'都能查出此人,请高手指点。
begin
SQL.Add('and kehu_xm like :kehu_xm');
Parameters.ParamByName('kehu_xm').Value:='%'+kehu_xm+'%';
end; 我想在这查询中在多加一个字段kehu_lp(联系人拼音)改如何修改,kehu_xm(联系人) 也就是当向参数kehu_xm 付上‘张三’或'zs'都能查出此人,请高手指点。
Parameters.ParamByName('kehu_xm').Value:='%'+kehu_xm+'%';
Parameters.ParamByName('aa').Value:='%'+kehu_xm+'%';
试试可以吗
SQL.Add('and ((kehu_xm like :kehu_xm) or (kehu_lp like :kehu_xm))');
Parameters.ParamByName('kehu_xm').Value:='%'+kehu_xm+'%';
end;--------------------------------------------------------------------
看尽悲伤,庸人自扰不平事。叹尽荒凉,海阔天空谁人知。狂风劲兮,百花飘
扬乱舞香。捏花一笑,海不扬波断肠心!
想返回数据集合用open
--------------------------------------------------------------------
看尽悲伤,庸人自扰不平事。叹尽荒凉,海阔天空谁人知。狂风劲兮,百花飘
扬乱舞香。捏花一笑,海不扬波断肠心!
广告:http://delphicode.yeah.net
begin
Close;
SQL.Clear;
SQL.Add('select * from fuwubiao where 1=1');
if kehu_xm<>'' then
begin
SQL.Add('and ((kehu_xm like :kehu_xm) or(kehu_lplike :kehu_xm))');
Parameters.ParamByName('kehu_xm').Value:='%'+kehu_xm+'%';
end;
Open;
end; 此处'%'+kehu_xm+'%'的kehu_xm值是用edit输入的,请给珍断,谢谢!
begin
Close;
SQL.Clear;
SQL.Add('select * from fuwubiao where 1=1 ');//这个地方加个空格
if kehu_xm<>'' then
begin
SQL.Add('and ((kehu_xm like :kehu_xm) or(kehu_lplike :kehu_xm))');
Parameters.ParamByName('kehu_xm').Value:='%'+kehu_xm+'%';
end;
Open;
--------------------------------------------------------------------
看尽悲伤,庸人自扰不平事。叹尽荒凉,海阔天空谁人知。狂风劲兮,百花飘
扬乱舞香。捏花一笑,海不扬波断肠心!
begin
Close;
SQL.Clear;
SQL.Add('select * from fuwubiao where 1=1 ');//这个地方加个空格
if kehu_xm<>'' then
begin
SQL.Add('and ((kehu_xm like :kehu_xm) or(kehu_lp like :kehu_xm))');
Parameters.ParamByName('kehu_xm').Value:='%'+kehu_xm+'%';
end;
Open;
///////////////////////////////////////////////////////////////////////////////
我没用过like后面有参数的。好象没什么问题。要不你改like为=吧。
先试试!
begin
Close;
SQL.Clear;
SQL.Add('select * from fuwubiao where 1=1 ');//这个地方加个空格
if kehu_xm<>'' then
begin
SQL.Add('and ((kehu_xm like :kehu_xm) or(kehu_lp like :kehu_xm1))');
Parameters.ParamByName('kehu_xm').Value:='%'+kehu_xm+'%';
Parameters.ParamByName('kehu_xm1').Value:='%'+kehu_xm+'%';
end;
Open;