嗨,我有以下SP,但是當我使用LINQ to SQL時,它會生成2個多記錄集。爲了我的理智,我試圖弄清楚它在存儲過程中是這樣做的,並希望只返回一個記錄集......可以提供任何幫助嗎?當我只想要一個時,Linq to SQL SP正在返回多個記錄集!
ALTER PROCEDURE [dbo].[CheckToken]
@LoginId int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @failures INT
SET @failures = (SELECT COUNT(loginid) FROM auditerrorcode WHERE
errorid = 1012 AND loginid = @loginid
AND datecreated > DATEADD(hh, -1, getdate())
)
IF @failures > 10 UPDATE [login] SET [IsDisabled]=1 WHERE loginid = @loginid
SELECT * FROM [Login] WHERE LoginId = @LoginId
END
這兩個結果是否一致?他們是否有相同的LoginId? – 2009-11-09 16:07:56
不,第一個記錄集包含登錄的所有字段,第二個記錄集包含IsDisabled的單個字段! – Rippo 2009-11-09 16:09:14