Parameter 'p_out_rows' not found in the collection.

MichaelYnag MichaelYnag 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
用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);
...全文

相关推荐

评论 1
收藏 已收藏
分享
返回顶部
MichaelYnag
C# 111,128 成员 642,536 内容