日期:2014-05-17 浏览次数:20504 次
OracleConnection conn = new OracleConnection(ConnectionString); string str = "select * from table1 where name like '%:name%'"; OracleCommand cmd = new OracleCommand(str, conn); OracleParameter name = new OracleParameter(":name", OracleType.Char, 50); name.Value = TextBox1.Text; cmd.Parameters.Add(name); conn.Open(); OracleDataReader dr = cmd.ExecuteReader();//到这里出错
"select * from table1 where name like N'%'+:name+'%'";
------解决方案--------------------
%
业务逻辑层把:name值得百分号给加上试试,然后把引号去掉