I'm trying to add a new table-valued udf to an existing LINQ-to-SQL designer in VS 2008. Everything goes fine and there are no compile errors or warnings; however when I try to execute the method I get the following error:
System.InvalidOperationException: The method is not mapped as a stored procedure or user-defined function...
I've checked the connection string, made sure the udf exists in the target database, and successfully queried another udf that was added previously. The Function attribute is present in the generated designer code. I've deleted the file and recreated it from scratch with the same results. I've successfully added udfs before and am baffled by this turn of events.
Have I missed something?
EDIT:
Here's the function:
ALTER FUNCTION [dbo].[GetIndividualInfoByName]
(
@Name varchar(50)
)
RETURNS TABLE
AS
RETURN
(
SELECT
Id
,Ssn
,FamilyName
,MiddleName
,GivenName
,Suffix
,Street1
,Street2
,Street3
开发者_如何学编程 ,City
,[State]
,PostalCode
,Country
FROM
Delta.dbo.IndividualInfo
WHERE
GivenName LIKE @Name Or FamilyName LIKE @Name
)
精彩评论