Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing stored procedure within loop

Status
Not open for further replies.

mhenley

IS-IT--Management
Aug 25, 2000
27
US
I'm calling two stored procedures (get_three and get_five)that are each returning a record set. I'm calling the first one then starting a loop until eof, where I use data from the first recordset to call the second...


DE.Get_three
Do until DE.rsGet_three.eof
three_id = DE.rsGet_three(1)("three_id")
DE.Get_five three_id
Do until DE.rsGet_five.eof
'display data here...
DE.rsGet_five.movenext
loop
DE.rsGet_three.movenext
loop


Loop one executes fine (the internal loop completes until eof) but after the get_three loop executes once I get "The operation requested by the application is not allowed if the object is open" on the line containing the call to the get_five procedure. I'm guessing I need to close the object before I call the procedure again with different data but I can't figure out how. I have tried DE.get_five.close and DE.rsGet_five.cancel, but doesn't seem to have any effect.

Any help would be greatly appreciated!
Matt
[sig][/sig]
 
FYI: I fixed this by closing the recordset (DE.rsGet_five.close )

DE.Get_three
Do until DE.rsGet_three.eof
three_id = DE.rsGet_three(1)("three_id")
DE.Get_five three_id
Do until DE.rsGet_five.eof
'display data here...
DE.rsGet_five.movenext
loop
DE.rsGet_Five.close
DE.rsGet_three.movenext
loop

[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top