模糊查询一个字段可以多个就出错 在pl/sql 中运行测试正常 而asp.net 就出错
错误为:
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
存储过程为:
CUR OUT SYS_REFCURSOR,
PAR_NID varchar2, PAR_NAMES varchar2, PAR_SPELL varchar2 )
IS INSR NUMBER; BEGIN
INSR:=LENGTH(PAR_NID); IF INSR>0 THEN OPEN CUR FOR SELECT * FROM CITY WHERE (SUBSTR(NID,0,INSR)=PAR_NID)AND (NAMES LIKE '%' || PAR_NAMES || '%' OR PAR_NAMES IS NULL) AND (SPELL LIKE '%' || PAR_SPELL || '%' OR PAR_SPELL IS NULL); ELSE OPEN CUR FOR SELECT * FROM CITY WHERE (NAMES LIKE '%' || PAR_NAMES || '%' OR PAR_NAMES IS NULL) AND (SPELL LIKE '%' || PAR_SPELL || '%' OR PAR_SPELL IS NULL); END IF; end; 调用为:
public static DataTable UP_city_GetList(city model) { OleDbParameter[] parm ={ oledate.CreateInParam("Par_NID",OleDbType.VarChar,100,model.nid), oledate.CreateInParam("Par_NAMES",OleDbType.VarChar,30,model.name), oledate.CreateInParam("Par_SPELL",OleDbType.VarChar,20,model.spell)}; return oledate.ExecuteTable(CommandType.StoredProcedure, "CITY_Search", parm); } 页面显示:
city model = new city(); model.name = ""; model.spell = ""; model.nid = ""; GridView1.DataSource = city.UP_city_GetList(model); GridView1.DataBind();
public static DataTable UP_city_GetList(city model)
{
OleDbParameter[] parm ={
oledate.CreateInParam("CUR",OleDbType.Cursor),
oledate.CreateInParam("Par_NID",OleDbType.VarChar,100,model.nid),
oledate.CreateInParam("Par_NAMES",OleDbType.VarChar,30,model.name),
oledate.CreateInParam("Par_SPELL",OleDbType.VarChar,20,model.spell)};
parm[0].Direction = ParameterDirection.Output;
return oledate.ExecuteTable(CommandType.StoredProcedure, "CITY_Search", parm);
}