1
How to recover the Output parameter of a storedProcedure?
SP Example:
create PROCEDURE StoreProcedure_Name
@ParametterWithNummvalue varchar(50) = null,
@In_Parameter varchar(50),
@Out_Parameter varchar(10) out
AS
set @Out_Parameter = 'teste'
RETURN 0
Code C#
SqlParameter[] Params = {
new SqlParameter("@ParametterWithNummvalue", DBNull.Value),
new SqlParameter("@In_Parameter", "teste novo"),
new SqlParameter("@Out_Parameter", SqlDbType.VarChar, 10) { Direction = ParameterDirection.Output }};
var r = Db.Database.ExecuteSqlCommand("exec StoreProcedure_Name @ParametterWithNummvalue, @In_Parameter, @Out_Parameter", Params);
var ReturnValue = Params[2].Value;
Returnvalue should contain the "test" value but is returning empty.
What do you really return? a string or int?
– Marco Souza
@Marconciliosouza sorry, misspelled is not int is varchar
– Alexandre Previatti