Entity framework Is not giving me data when I call storeprocedure from entity framework? How can I get data. RRS feed

  • Question

  • User-199788946 posted

    I am calling storeprocedure like:

    var spData = context.s_UserMenuOptions("UserId"); //when i hover over my store procedure it's return type is integer 

    spData has value -1 

    actually when I actually execute in my mssql like:

    [dbo].[s_UserMenuOptions] '00101'

    it is giving me data 

    I want to data instead of returning -1 to my spData variable how can I do that?

    Monday, May 25, 2020 4:11 AM


  • User-199788946 posted

    I have solve my problem by using following code: -thank you

    SqlParameter[] param = new SqlParameter[]
    new SqlParameter("@UserId",UserId),
    var data = nicDBEntities.Database.SqlQuery<Menu_TableVm>("s_UserMenuOptions @UserId", param).ToList();

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 25, 2020 11:04 AM