Take the 2-minute tour ×

Hi I have the following SP, however when I use LINQ to SQL it generates 2 multiple recordsets. For my sanity I am trying to fathom out what it is in the stored procedure that is doing this and would like to only return a single recordset... Can any help?

    ALTER PROCEDURE [dbo].[CheckToken] 
        @LoginId int
        -- SET NOCOUNT ON added to prevent extra result sets from
        -- interfering with SELECT statements.

        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

share|improve this question
Are the two results identical? Do they have the same LoginId? –  Michael La Voie Nov 9 '09 at 16:07
No, the first recordset contains all the fields for login and the second contains a single field for IsDisabled! –  Rippo Nov 9 '09 at 16:09
add comment

2 Answers

Execute your procedure stand alone and rule out your not getting two rows because there are two rows being returned for the ID you are passing in. Do this in SQL Managment Studio with a

EXEC dbo.CheckToken 999

Make sure to use the same @LoginID that you are calling from your .NET code.

share|improve this answer
I have already done this... –  Rippo Nov 9 '09 at 16:06
add comment
up vote 0 down vote accepted

Sorry Guys....

I looked again in the DBML file generated and deleted the CheckToken method which had multiple result sets defined. I then regenerated and now I get what I expected, one recordset

Looks like the mods I made to the SP has worked.

share|improve this answer
add comment

Your Answer


