开发者

Mapping UDF using LINQ-to-SQL Designer

开发者 https://www.devze.com 2023-01-15 10:26 出处:网络
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 ge

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
)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号