我Dapper用来调用具有必需参数的存储过程@idProject
这是我的代码片段:
using (var c = _connectionWrapper.DbConnection)
{
var result = c.Query<Xxx>("dbo.xxx_xxxGetPage", new { @idProject = 1 }).AsList();
return result;
}
Run Code Online (Sandbox Code Playgroud)
应该工作但提出异常:
System.Data.dll中出现"System.Data.SqlClient.SqlException"类型的异常,但未在用户代码中处理
附加信息:过程或函数'xxxGetPage'需要参数'@idProject',它未提供.
为什么?
我认为你错过了CommandType。
using (var c = _connectionWrapper.DbConnection)
{
var result = c.Query<Xxx>("dbo.xxx_xxxGetPage", new { idProject = 1 }, commandType: CommandType.StoredProcedure).AsList();
return result;
}
Run Code Online (Sandbox Code Playgroud)
默认情况下,dapper 使用文本。
https://github.com/StackExchange/dapper-dot-net
| 归档时间: |
|
| 查看次数: |
539 次 |
| 最近记录: |