public DataTable ShowFindscout(string name,string verid)
{
string strline=name;
string [] aryline=null;
string ss="";
aryline = strline.Split(new char[] { ',' });
if(aryline.Length>=2)
{
for (int j = 0; j< aryline.Length; j++)
{
if (j==(aryline.Length-1))
{
ss=ss+"Coupon LIKE '%" +aryline[j]+"%' or "+"Chrcontent LIKE '% or "+aryline[j]+"%' or "+"Keyword LIKE '%"+aryline[j]+"%'";
}
else
{
ss=ss+"Coupon LIKE '%" +aryline[j]+"%' or "+"Chrcontent LIKE '% or "+aryline[j]+"%' or "+"Keyword LIKE '%"+aryline[j]+"%' or ";
}
}
}
else
{
for (int j = 0; j< aryline.Length; j++)
{
ss="Coupon LIKE '%" +aryline[j]+"%' or "+"Chrcontent LIKE '%"+aryline[j]+"%' or "+"Keyword LIKE '%"+aryline[j]+"%'";
}
}
myConn.dbQuery("select Nid,Chrtitle,Chrcontent,Dtappenddate from Life_find where Isopen=1 and verid="+verid+" and ("+ss+") ");
return myConn.FileValue;
}
上面是我写的代码 传值例如:a,b,c
得到 SQL入下
select * from where verid=2 and (Coupon LIKE '%a' or Chrcontent LIKE '%a' Keyword LIKE '%a' or Coupon LIKE '%b' or Chrcontent LIKE '%b' Keyword LIKE '%b' or Coupon LIKE '%c' or Chrcontent LIKE '%c' Keyword LIKE '%c')
现在想把上面的方法改下 传值成 a,b,c|A,B,C
得到SQL如下:请帮我改下
select * from where verid=2 and (Coupon LIKE '%a' or Chrcontent LIKE '%a' Keyword LIKE '%a' or Coupon LIKE '%b' or Chrcontent LIKE '%b' Keyword LIKE '%b' or Coupon LIKE '%c' or Chrcontent LIKE '%c' Keyword LIKE '%c') and (Coupon LIKE '%A' or Chrcontent LIKE '%A' Keyword LIKE '%A' OR Coupon LIKE '%B' or Chrcontent LIKE '%B' Keyword LIKE '%B')