You must Sign In to post a response.
  • Category: LINQ

    How to Fetch data of pivot result from SP


    Are you looking for a way to Fetch data of pivot ? want to fetch it using stored procedure ? then read this thread to know how to do it



    Hi
    I m using Entity framework in asp.net MVC. I wrote a sql stored procedure for fetch a pivot result. Now, I need to retrieve the results in C# entity framework. I know that by using ADO.net I can succeed but I don't want to use ADO.NET in my application. I m writing format how my SP would be

    CREATE PROC SPSomeResult(...) AS
    BEGIN
    DECLARE @Query varchar(max)

    SET @Query=SOME CODE TO FETCH DATA
    EXECUTE(@Query)
    END
  • #758782
    Hi Ajay,

    Do you what data is going to extracted from this SP. If the extract data is already in entity class then you can execute the procedure using query option in entity framework by mentioning the entity type.

    If you are using edmx file format then you have to update the edmx file and select the newly created SP and then you can specify the out type, whether existing entity class or complex entity.

    If you specify the complex option then the edmx will created with new method for that SP and you can call that method by creating the context object.

    Regards
    Saravanan S


  • Sign In to post your comments