Parameter 'p_out_rows' not found in the collection.
用mysql 写了一个分页的存储过程,比较简单,保证没错,因为已经测试其正确与否。
在C#中调用该存储过程,报上面的错误。在网上查了几天帖子,没有一个清楚的解决思路。
查了mysql官网,说这个是2008年一版本中的bug。求达人指教!谢谢
C#调用的实例,如下
#region 存储过程参数设置
MySqlParameter tablenameparm = new MySqlParameter("p_table_name", MySqlDbType.VarChar);
tablenameparm.Direction = ParameterDirection.Input;
tablenameparm.Value = tableName;
MySqlParameter fildsparm = new MySqlParameter("p_fields", MySqlDbType.VarChar);
fildsparm.Direction = ParameterDirection.Input;
fildsparm.Value = filds;
MySqlParameter wherefield = new MySqlParameter("p_where_string", MySqlDbType.VarChar);
wherefield.Direction = ParameterDirection.Input;
wherefield.Value = strWhere;
MySqlParameter pageindexfield = new MySqlParameter("p_pageNo", MySqlDbType.Int32);
pageindexfield.Direction = ParameterDirection.Input;
pageindexfield.Value = pageIndex;
MySqlParameter perpageCnt = new MySqlParameter("p_perPageCnt", MySqlDbType.Int32);
perpageCnt.Direction = ParameterDirection.Input;
perpageCnt.Value = pageCount;
MySqlParameter porderparm = new MySqlParameter("p_order_string", MySqlDbType.VarChar);
porderparm.Direction = ParameterDirection.Input;
porderparm.Value = orderValue;
MySqlParameter recordtotalfield = new MySqlParameter("p_out_rows", MySqlDbType.Int64);
recordtotalfield.Direction = ParameterDirection.Output;
#endregion
MySqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.connString, CommandType.StoredProcedure, "PageSection",tablenameparm,fildsparm,wherefield,pageindexfield,perpageCnt,porderparm,recordtotalfield);
int result = SqlHelper.ExecuteNonQuery(SqlHelper.connString, CommandType.StoredProcedure, "PageSection",tablenameparm,fildsparm,wherefield,pageindexfield,perpageCnt,porderparm,recordtotalfield);