entity framework - return multiple columns from stored procedure in MVC -


was using line in controler return id , text column from, stored procedfure in asp.net mvc

user = new selectlist(ctx.database.sqlquery<lkupgendermodel>("exec dbo.uspgetlkupgender").tolist(), "genderid", "gender"); 

however want return more text values, have extended model have these fields i'm getting error.

is there way working:

user = new selectlist(ctx.database.sqlquery<lkupgendermodel>("exec dbo.uspgetlkupgender").tolist(), "genderid", "gender", "gendershort", "gendercombined"); 

currently flags selectlist( saying call ambiguous

the previous code returns instances of lkupgendermodel , builds selectlist using genderid property of class value , gender property display text.

your new code doesn't request more properties, passes additional parameters selectlist constructor: namely, datagroupfield you're setting gendershort property, , selectedvalue, you're setting gendercombined property. see: https://msdn.microsoft.com/en-us/library/dn725507(v=vs.118).aspx.

if have additional columns being returned stored procedure want filled in on class, should add additional properties class handle those. however, since you're doing data creating selectlist it, can't send additional data view other value , display text, making returning additional data pointless in instance.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -