Using OUTPUT parameter in Entity Framework


hi all,

i have stored procedure returns 3 output parameters later want to use parameters next subsequent inserts. stored procedure.

1    create procedure [dbo].[sptransactioninsert]  2    	@transactiontype varchar(255) ,  3    	@transactiondate datetime ,  4    --	.... (more fields)  5    	@transactionid varchar(50) output,  6    	@transactionno varchar(50) output,  7    	@transactionserialno bigint output  8      9    as  10   begin  11     12   	-- transaction id if parameter value 0   13   	-- (i.e) first time generate transaction id , send   14   	-- next time same transaction id used  15   	if @transactionid = '0'  16   		select @transactionid = [......] from transactiontable  17   	else  18   		set @transactionid = @transactionid  19     20   	-- transaction no if parameter value 0   21   	-- (i.e) first time generate transaction no , send   22   	-- next time same transaction id used  23   	if @transactionno = '0'  24   	begin  25   		select @transactionserialno = [......] from transactiontable  26   		set @transactionno = @type + '-' + cast(@transactionserialno as varchar)  27   	end  28   	else  29   	begin  30   		set @transactionno = @transactionno  31   		set @transactionserialno = @transactionserialno  32   	end  33     34   	insert into transactiontable ....  35     36     37   end  

i added table , procedures in entity model. if set stored procedure mapping table gives exception (error 2047: mapping function binding specifies function model.store.sptransactioninsert unsupported parameter: transactionid. output parameters may mapped through rowsaffectedparameter property. use result bindings return values function invocation.)

i using vs 2010, ef 4 and sl 4. how achieve this?

thanks advance.

hi,

as far remember, output params not supported in ef. if want return value sp, use "select @youroutparam outparam". can map property want scalar. give shot...

eyal



Silverlight  >  WCF RIA Services with Silverlight



Comments

Popular posts from this blog

SQL Server PSProvider SQL Server Authentication

BIT Version

How to calculate the delta size while diffing the files in TeamFoundationServer ?