Error: Unknown Return Type, The return types for the following
stored procedures could not be detected….(LINQ).
Error: Unknown Return Type, The
return types for the following stored procedures could not be detected…..
Error:
The return types for the following
stored procedures could not be detected. Set the return type for each stored
procedure in the Properties window.
Situations
This error usually comes when you are
trying to add your Stored Procedure into DBML (LINQ) file.
Cause
This problem occurs whenever the
designer cannot figure out the return type of the SP. This usually
happens when the stored procedure has multiple results or uses a temp table. The
SQL Server feature that attempts to derive the Meta data of the function
reports no columns for the result shape, so the designer defaults to thinking
it only has the single int return value.
Solutions
· The one way to get
these types of stored procedures to work is to edit DBML by hand or write
your own method signature for the procedure in a partial class To Handle multiple
record set return from stored procedure by LINQ see the link here.
· The second way is to avoid using #temp Table
in your stored procedure, instead of you can use Table type variable like
below (@TempTable)
Ex:
DECLARE @TempTable TABLE
(
AttributeID INT,
Value NVARCHAR(200)
)
INSERT INTO @TempTable Select
* from Attribute
OR
--Execute
SP and insert results into @TempTable
INSERT INTO @TempTable Exec
GetAttribute @Id
You can do all
operation which you was doing with #Temp table like Join, Insert, Select etc.
|
No comments:
Post a Comment