none
Call Stored Procedure RRS feed

  • Question

  • I have a stored procedure that returning Temp Table. How can I call this SP using LINQ???


    Create PROCEDURE [dbo].[Sp_Test]
    @UserID int
    AS
    BEGIN
        
        Create Table #TempTable
        (
            RowNumber int Identity(1,1),
            UserID int,
            UserName nvarchar(250),
            Designation nvarchar(250),
            Department nvarchar(250),
            JobFamily nvarchar(250)
        )


        Insert Into #TempTable (UserID, UserName, Designation, Department, JobFamily)
        Values (1,'Test Name1','Designation1','Department1','Job Family1')

        Insert Into #TempTable (UserID, UserName, Designation, Department, JobFamily)
        Values (2,'Test Name2','Designation2','Department2','Job Family2')

        Insert Into #TempTable (UserID, UserName, Designation, Department, JobFamily)
        Values (3,'Test Name3','Designation3','Department3','Job Family3')

        Insert Into #TempTable (UserID, UserName, Designation, Department, JobFamily)
        Values (4,'Test Name4','Designation4','Department4','Job Family4')

        Insert Into #TempTable (UserID, UserName, Designation, Department, JobFamily)
        Values (5,'Test Name5','Designation5','Department5','Job Family5')
        
        Select UserID, UserName, Designation, Department, JobFamily        
        From
            #TempTable
       
    END
    Thursday, January 14, 2016 9:52 AM

Answers

All replies

  • please read this article : here

    or watch this video : here this will answer your question.


    Hope it helps. Spiri

    Thursday, January 14, 2016 10:01 AM
  • Thank you very much for replying.

    But I am trying to access Temporary Table, not an existing table. That is the worry point.

    Thursday, January 14, 2016 10:17 AM
  • the return value of this SP will be a dataTable, so put the result of this store Procedure in dataTable variable.

    Hope it helps. Spiri

    Thursday, January 14, 2016 11:16 AM