The return types for the following stored procedures could not be detected

后端 未结 15 2138
小鲜肉
小鲜肉 2020-12-09 08:09

While drag-drop a stored procedure in dbml file I get this error:

Unknown Return Type
The return types for the following stored

15条回答
  •  时光取名叫无心
    2020-12-09 08:52

    Just ran into this issue while trying to add a stored procedure into a DBML (LINQ) file.

    Doing some research I found that this usually happens when the stored procedure returns multiple results or uses a #temp table for it's final select.

    The solution that worked for me was to create a new stored procedure that wrapped the results of the original stored procedure result, into a table variable with the same columns as the temp table.

    My wrapper stored proc looked something like this:

    DECLARE @NewPrograms TABLE (
        Campaign_Number int,
        Campaign_Display nvarchar(255)
    )
    
    INSERT INTO @NewPrograms
        EXEC [dbo].[Original_Stored_Proc_With_Temp_Table_Result] @Program_ID
    
    
    Select * 
    From @NewPrograms
    

    Open up your DBML file, drag-and-drop in your new wrapper stored proc.

提交回复
热议问题