PetaPoco 和存储过程的输出参数?
我正在尝试使用 PetaPoco 设置输出参数。我发现有人在线使用此示例:
var ctx = new CustomDBDatabase();
var total = new SqlParameter("Total", System.Data.SqlDbType.Int);
total.Direction = System.Data.ParameterDirection.Output;
var results = ctx.Query<DBEntity>("exec GetDBEntities @StartIndex, @MaxIndex, @TotalCount = @Total out",
id, start, max, total);
int totalCount = (int)total.Value;
但是,total.value
返回 null,即使当我直接针对 SQL Server 运行此语句时,它也会返回我 3. PetaPoco 的设置正确吗?是否支持输出参数?
谢谢。
I'm trying to setup an output parameter using PetaPoco. I found someone using this sample online:
var ctx = new CustomDBDatabase();
var total = new SqlParameter("Total", System.Data.SqlDbType.Int);
total.Direction = System.Data.ParameterDirection.Output;
var results = ctx.Query<DBEntity>("exec GetDBEntities @StartIndex, @MaxIndex, @TotalCount = @Total out",
id, start, max, total);
int totalCount = (int)total.Value;
However, total.value
returns null, even though when I run this statement directly against SQL Server, it returns me 3. Is this setup correctly with PetaPoco? Are output parameters supported?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是支持的。但无论如何,你当前的语法是错误的。
像这样的东西应该可以工作。不太确定 sql 语法,但这应该可以帮助您上路。
This is supported. But your current syntax is wrong anyways.
Something like this should work though. Not quite sure of the sql syntax but this should get you on your way.