日期:2014-05-17 浏览次数:20524 次
declare @a varchar(10) set @a='2'--黑色 select * from tb where charindex(','+@a+',',','+ colorID+',')>0
------解决方案--------------------
下面的方法肯定行用Contains方法:
String str = "1,2,3,4,5";//你数据库中查询出的colorID字段 String temp=","+str+","; int i = 2; int j = 6; bool b1=str.Contains(","+i+",");//包含2返回true; bool b2=str.Contains(","+j+",");//不包含6返回false Response.Write(b1+" "+b2);
------解决方案--------------------