sql server - "Operation is not allowed when the object is closed" when executing stored procedure -
this stored procedure, , when calling classic asp code, getting error:
operation not allowed when object closed.
when try record count.
does know wrong here?
i trying return table @t
.
thanks.
use [hires_new] go /****** object: storedprocedure [dbo].[sp_selectnewhireworkperiodssql] script date: 05/13/2013 14:04:12 ******/ set ansi_nulls on go set quoted_identifier on go -- ============================================= -- author: -- create date: -- description: -- ============================================= alter procedure [dbo].[sp_selectnewhireworkperiodssql] -- add parameters stored procedure here declare @t table (hireid int, startdate datetime, enddate datetime, date_initiated datetime, date_closed datetime, firmname nvarchar(100), inquiryid int) declare @acc int set @acc = 1 declare @max int select @max = max(hireid) newhire while (@acc <= @max) begin if (@acc in (select hireid newhire)) begin insert @t select hireid, startdate, enddate, date_initiated, date_closed, firmname, inquiries.inquiryid workperiod, firms, inquiries hireid = @acc , workperiod.firmid = firms.firmid , workperiod.inquiryid = inquiries.inquiryid order hireid,startdate desc end set @acc = @acc + 1 end select * @t
asp classic code
selectnewhireworkperiodssql = "exec sp_selectnewhireworkperiodssql" set rsnewhireworkperiods = server.createobject("adodb.recordset") rsnewhireworkperiods.open selectnewhireworkperiodssql,connectionstring,adopenstatic numofnewhireworkperiods = rsnewhireworkperiods.recordcount response.write(numofnewhireworkperiods)
try in stored procedure:
set nocount on
set ansi_warnings off
right below as.
Comments
Post a Comment