Erreur ADODB.Recordset '800a0e78' L'opération n'est pas autorisée lorsque l'object est fermé. ASP classique

Je sais que c'est probablement une dupe d'une autre question mais je n'ai vraiment aucune idée, j'ai cherché partout et essayé tout mais il semble toujours me donner la même erreur de;

Erreur ADODB.Recordset '800a0e78'

L'opération n'est pas autorisée lorsque l'object est fermé.

Si quelqu'un pouvait m'aider avec ceci, ce serait grandement apprécié, j'utilise ASP classique, SQL et HTML;

Mon code ASP classique est;

If(Request.Form("submitBtn"))<>""Then 'Initialise the db connection Set objDBConn = Server.CreateObject("ADODB.Connection") objDBConn.Open "Provider=sqloledb;Data Source=OLIVERBEELEY;Initial Catalog=HolidayEmployeeBooker;User ID=HBA;Password=HBA;" 'Initialise the command object Set objDBCommand = Server.CreateObject("ADODB.Command") objDBCommand.ActiveConnection = objDBConn objDBCommand.CommandText = "spNewHoliday" objDBCommand.CommandType = adCmdStoredProc 'Set the parameters objDBCommand.Parameters.Append objDBCommand.CreateParameter("@StartDate", adDate, adParamInput,200) objDBCommand.Parameters.Append objDBCommand.CreateParameter("@EndDate", adDate, adParamInput,200) objDBCommand.Parameters.Append objDBCommand.CreateParameter("@EmployeeID", adVarChar, adParamInput,200) objDBCommand.Parameters.Append objDBCommand.CreateParameter("@Reason", adVarChar, adParamInput,200) objDBCommand("@StartDate") = Request.Form("from") objDBCommand("@EndDate") = Request.Form("to") objDBCommand("@EmployeeID") = Session("UserID") objDBCommand("@Reason") = Request.Form("comments") 'Initialise the Recordset Set objDBRS = Server.CreateObject("ADODB.RecordSet") 'Execute objDBRS.open objDBCommand,,adOpenForwardOnly if not objDBRS.EOF then Session("BookingValid") = objDBRS(0) end if if Session("BookingValid") = "ErrorBookingHoliday" then response.Write("<SCRIPT LANGUAGE=""JavaScript"">alert(""Holiday CANNOT be booked."");</SCRIPT>") end if if Session("BookingValid") = "ErrorBookingHoliday" then response.Write("<SCRIPT LANGUAGE=""JavaScript"">alert(""Holiday has been requested."");</SCRIPT>") end if 'Close and Destroy Objects - Start******************************************************* Set objDBCommand=nothing objDBConn.Close Set objDBConn=nothing 'Close and Destroy Objects - End********************************************************* response.redirect("newbooking.asp") end if %> 

Ma procédure stockée son appel sont;

 PROCEDURE [dbo].[spNewHoliday] ( @StartDate DATE, @EndDate DATE, @EmployeeID INT, @Reason NVARCHAR (45) ) AS SET NOCOUNT ON BEGIN IF NOT EXISTS ( SELECT 1 FROM Holidays WHERE @StartDate = StartDate AND @EndDate = EndDate AND @EmployeeID = EmployeeID) BEGIN DECLARE @Validation INT EXEC spBusinessRuleValidation @StartDate, @EndDate, @EmployeeID, @Validation OUTPUT IF @Validation = 0 BEGIN DECLARE @DaysOff AS INT SELECT @DaysOff = (DATEDIFF(Day,@StartDate,@EndDate) +1) UPDATE Employees SET AnnualDaysHolidayAllowance = AnnualDaysHolidayAllowance - @DaysOff WHERE @EmployeeID = Employees.ID INSERT INTO Holidays(EmployeeID, StartDate, EndDate, Duration, Status, Reason) VALUES(@EmployeeID, @StartDate, @EndDate, @DaysOff,'Pending', @Reason) SELECT Employees.AnnualDaysHolidayAllowance AS Daysleft FROM Employees WHERE @EmployeeID = Employees.ID END SET NOCOUNT ON IF @Validation = 1 BEGIN SELECT 'ErrorBookingHoliday' AS FailedBooking END END END 

Et la procédure stockée que cette procédure appelle est;

 PROCEDURE [dbo].[spBusinessRuleValidation] ( @StartDate DATE, @EndDate DATE, @EmployeeID INT, @Validation INT output ) AS SET NOCOUNT ON BEGIN DECLARE @JobRoleID INT DECLARE @MaxJobTypeAllowedOff INT DECLARE @MaxEmployeesAllowedOff INT DECLARE @DateCount INT DECLARE @SameJobRoleOff INT DECLARE @DateCheck DATE SET @JobRoleID = (SELECT JobRoleID FROM Employees WHERE @EmployeeID = Employees.ID) SET @MaxJobTypeAllowedOff = (SELECT MaxEmployeesAllowedOff FROM JobRole WHERE @JobRoleID = JobRole.ID) SET @MaxEmployeesAllowedOff = 20 SET @DateCheck = @StartDate SET @EndDate = DATEADD(DAY, 1, @EndDate) SET @Validation = '0' WHILE (@DateCheck <> @EndDate) BEGIN SET @DateCount = (SELECT COUNT (*) FROM Holidays WHERE Holidays.Startdate >= @DateCheck AND Holidays.EndDate <= @EndDate ) IF @DateCount > @MaxEmployeesAllowedOff BEGIN SET @Validation = '1' BREAK END SET @SameJobRoleOff = (SELECT COUNT (*) JobRoleID FROM Employees RIGHT JOIN Holidays ON Employees.ID = Holidays.EmployeeID WHERE Employees.ID = @EmployeeID AND Holidays.Startdate >= @DateCheck AND Holidays.EndDate <= @EndDate AND Holidays.Status <> 'Declined') IF @SameJobRoleOff > @MaxJobTypeAllowedOff BEGIN SET @Validation = '1' BREAK END SET @DateCheck = DATEADD(DAY, 1, @DateCheck) END END 

Je suis très nouveau à SQL et ASP (environ 3-4 mois d'expérience) et besoin d'aide avec ce problème, toute aide serait appréciée même si c'est juste à faire avec du code qui n'est pas la cause de mon erreur! Merci! OH c'est le code où ça va mal!

 if not objDBRS.EOF then Session("BookingValid") = objDBRS(0) end if 

J'ai quelques SP qui returnnent un jeu d'loggings à une rangée à la fin de leur opération, en utilisant quelque chose comme

  SELECT @some_symbol some_column_name; 

Si SET NOCOUNT ON de ces procédures stockées, alors mon jeu d'loggings ASP adodb classique n'est pas returnné correctement, et j'obtiens l'erreur "object est fermé".

Si SET NOCOUNT ON dans ces procédures stockées, les choses fonctionnent correctement.

La même chose est vraie si je cours un bloc ordinaire de SQL, pas une procédure stockée, qui fonctionne de la même manière.

En ce qui concerne ASP classique, je suis définitivement dans le "pourquoi requestr pourquoi?" camp. Je dois juste faire mon travail de maintenance.