dotnetcore / dotnetcore/FreeSql

关于使用Ado执行存储过程output为空

Open
#1,702 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.4k
Forks
910
PR merge metrics
No merged PRs in 30d

Description

我在使用Ado执行sqlServer存储过程时,发现定义了output参数,但是始终接收不到存储过程的输出参数。
不知道哪里出错了
这里是我测试的代码:
DbParameter p2 = null;
var procedureDT= BaseServices._systemDb.Ado.CommandFluent("dbo.test")
.CommandType(System.Data.CommandType.StoredProcedure)
.CommandTimeout(60)
.WithParameter("totalCount", null, p =>
{
p2 = p; //Output 参数
p.DbType = DbType.Int32;
p.Direction = ParameterDirection.Output;
})
.ExecuteDataTableAsync() ;

这里是存储过程代码:
ALTER PROCEDURE [dbo].[test2]
@totalCount int OUTPUT
AS
BEGIN
select @totalCount=2
END

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.