且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Entity Framework Core - 使用带有输出参数的存储过程

更新时间:2023-09-10 21:15:52

它应该可以工作,但我相信您还需要在命令语句中包含参数名称和 OUT 关键字

It should work, but I believe you also need to include the parameter names and the OUT keyword in the command statement

var sql = "exec spTestSp @ParamIn1, @ParamIn2, @ParamOut1 OUT, @ParamOut2 OUT";
var result = db.Database.ExecuteSqlCommand(sql, in1, in2, out1, out2);

var out1Value = (long) out1.Value;
var out2Value = (string) out2.Value;