我有这个用于登录的存储过程
ALTER PROCEDURE usp_Login
(
@username varchar(50),
@password varchar(50)
)
AS
BEGIN
DECLARE @loginflag VARCHAR(1)
IF EXISTS (SELECT dbo.tbl_Login.Id FROM dbo.tbl_Login WHERE (dbo.tbl_Login.LoginId = @username))
BEGIN
IF ((SELECT COUNT(dbo.tbl_Login.Id) FROM dbo.tbl_Login WHERE (dbo.tbl_Login.LoginId = @username) AND (dbo.tbl_Login.Loginpassword= @password))> 0)
BEGIN
WITH LoggedInUser AS
(
SELECT L.LoginId,L.LoginRole,L.LoginPassword,L.UserId,S.FatherName,S.Name,S.RollNo,S.Marks,S.Dob, S.Address,S.PhoneNumber,S.CityId,S.EmailAddress,S.Gender,S.Password, S.SiteUrl,S.StuAvtar,S.StuCv FROM dbo.tbl_Login AS L INNER JOIN dbo.tbl_Student AS S ON L.UserId = S.Id
WHERE L.LoginPassword=@password AND L.LoginId=@username
)
SELECT *FROM LoggedInUser
END
ELSE
SELECT -98 AS Error --User Password Wrong
END
ELSE
SELECT -99 AS Error --USER NOT EXISTS
END
我想将它与具有返回结果的实体框架一起使用。我该怎么做?请帮我...