I have a stored procedure which contains a loop.
I am then trying to return the results of this stored procedure onto my ASP page into a recordset.
I want to loop through this recordset to obtain the values from the loop in the stored procedure.
However, it will not allow me to move backwards in the recordset because it is populated via a live feed.
Does anyone know if/how this could be done.
I am using the following code on the ASP page
Set cmd_Execute_stored_procedure = Server.CreateObject("ADODB.Command")
cmd_Execute_stored_procedure.ActiveConnection = cnnpayreview
cmd_Execute_stored_procedure.CommandText = "sp_summaryrg"
cmd_Execute_stored_procedure.CommandType = AdCmdStoredProc
set objcluster_sp = cmd_Execute_stored_procedure.Execute()
objcluster_sp.movefirst
do while not objcluster_sp.eof
response.write(objcluster_sp("counta")
objcluster.movenext
loop
...
--suppress the (1 row(s) affected) messages
SET NOCOUNT ON
--Create a temp table
CREATE TABLE #Temp
(
counta int,
countbon int
)
insert your items into the temp table instead of using SELECT
at the bottom of your sp add
SELECT * FROM #Temp
--turn the (1 row(s) affected) messages back on
SET NOCOUNT OFF