While drag-drop a stored procedure in dbml file I get this error:
Unknown Return Type
The return types for the following stored
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.
I've just added about 300 stored procs to my DBML and experienced many of the problems noted here and elsewhere.
Here is a summary of the causes & solutions for the error "The return types for the following stored procedures could not be detected", based on what I have personally experienced. Note that the problems described below can occur in the SP that you are having the error with, or any other SP that is being called from that SP directly or indirectly.
I had this error too and finally I found out that I have changed a table field name and in procedure it did not change it yet, and so it showed an error when adding to dbml.
Now you can check this on your procedure and your table that fields are the same.
I hope this experience is useful.