We find out an issue from stored procedure with DynamicParameters.Get("@outstring"). it always error exception converting data type nvarchar(max) to int.
stored procedure code:
ALTER PROC [dbo].[usp_Test]
@RESULT INT OUT,
@OUTSTRING NVARCHAR(MAX) OUT
ASSET @RESULT=1SET @OUTSTRING ='HELLO WORLD!!'
c# code:
vardparams=newDynamicParameters();dparams.Add("@RESULT",DbType.Int32,direction:ParameterDirection.Output);dparams.Add("@OUTSTRING",DbType.String,direction:ParameterDirection.Output);introw=conn.Execute("usp_Test",dparams,commandType:CommandType.StoredProcedure);result=newResult(){RESULT=dparams.Get<int>("@RESULT"),OUTSTRING=dparams.Get<string>("@OUTSTRING")// here};
We find out an issue from stored procedure with DynamicParameters.Get("@outstring"). it always error exception converting data type nvarchar(max) to int.
stored procedure code:
c# code: