我有三张表;我在ADO.NET Entity Framework中编写了一个存储过程。
ALTER PROCEDURE [dbo].[sp_GetDepartmanData]
(@departman nvarchar(50))
BEGIN
SELECT
d.ID, d.Name as DepartmanName,
sb.Salary, sb.email,
sp.Name, sp.SurName, sp.Phone, sp.Married, sp.Address
FROM
Departman d
INNER JOIN StaffsBusiness sb ON d.ID = sb.StaffsPersonelDepartmanID
INNER JOIN StaffsPersonel sp ON sb.StaffsPersonelID = sp.ID
WHERE
d.Name = @departman
END
我需要一个存储过程函数,以下是我编写的代码:
var staffPersonel = staffContext.GetPersonelInformationWithDepartmanID("Yazılım");
gvPersonel.DataSource = staffPersonel;
gvPersonel.DataBind();
我从SQL中编写了GetPersonelInformationWithDepartmanID函数(在ADO.NET实体框架中定义的用户定义函数),这里有3个备选项(这很愚蠢!!!),但是我有3个连接表!!!。如果我先连接3个表,我该怎么使用它?