日期:2014-05-17 浏览次数:20509 次
string sql=@"select count(0) from Ship where 1=1 and SCode=@SCode and OCode=@OCode and (SCode=@SCode OR SCode=@SCode) and SCode=@SCode and ?=@SCode or ?=@SCode or SCode like '%'+@SCode+'%'"; sql=Regex.Replace(sql,@"(?i)(and \?=@SCode)|(or \?=@SCode)",""); /* select count(0) from Ship where 1=1 and SCode=@SCode and OCode=@OCode and (SCode=@SCode OR SCode=@SCode) and SCode=@SCode or SCode like '%'+@SCode+'%' */
------解决方案--------------------
string pattern = @"(and|or)\s*\?=@SCode";
------解决方案--------------------
(?i)(and\s*\?=@SCode)|(or\s*\?=@SCode)试试,
你最好给个例子,说你要的结果
------解决方案--------------------
说的啥子哟
------解决方案--------------------
cmd.CommandText=sql;
cmd.SqlParameters.AddRange(paras);
Regex(cmd.CommandText,"and\s+\w+=null"," ");
------解决方案--------------------
这哥们
我不知道你说的什么啊。
------解决方案--------------------
不知所云啊
描述不清楚就给例子,并给出对应的结果,一定要给结果