日期:2014-05-17  浏览次数:21156 次

C# 模糊查询时 oracle 参数化 特殊字符
oracle 数据库中数据如图( 带有 % ):


①页面查询条件不固定(拼接条件)

② 查询条件必须参数化

要求:查询出IMG_NOTE 列中 含有 % 的数据。

求实现方式。
c# oracle

------解决方案--------------------
instr(varchar,'string') >-1
------解决方案--------------------
界面查询条件处理 

condition =  condition replace ("%","\%"); replace ("\","\\");

然后 查询sql语句的写法

 select xx from tabs where field like '%" + condition + "%' escape '\'
------解决方案--------------------
用replace试试

可以参考这篇文章http://www.cnblogs.com/jice/archive/2012/10/23/2735674.html