Exceute SP with out parameter using Dapper always get null value (Dapper+ODBC+Sybase) -
i have problem executing sp dapper using odbc sybase, input parameter not have problems, when tried out parameter not working expected.
original sp have insert statement put transaction statement in code.
here modified sp:
create proc dbo.sp_test_dapper(@first_parm varchar(10), @errormessages varchar(1000 ) out ) begin declare @rtn int declare @tranname varchar(50) select @tranname = 'sp_test' begin transaction @tranname if @first_parm = '1' begin select @errormessages = 'ok' end begin select @errormessages = 'error' goto error_trap end commit transaction @tranname select @errormessages error_trap: rollback transaction @tranname select @errormessages end
your implementation odbc named parameters incorrect. encase named parameter question marks in statement , create named parameter without question marks. question marks used dapper parse statement find names.
storedprocedurename = "dbo.sp_test_dapper ?first_parm?, ?errormessages?"; px.add("first_parm",firstparm); px.add("errormessages", dbtype: dbtype.string, direction: parameterdirection.output, size: 1000);
see answer more information: https://stackoverflow.com/a/26484944/6490042