Classic ASP Recursive function

Posted by user333411 on Stack Overflow See other posts from Stack Overflow or by user333411
Published on 2010-05-05T12:18:53Z Indexed on 2010/05/05 15:38 UTC
Read the original article Hit count: 250

Filed under:
|
|
|

Hi everyone,

I havent done any classic ASP for a couple of years and now trying to get back into it from c# is prooving impossible! I've got a recursive function which very simply is supposed to query a database based on a value passed to the function and once the function has stopped calling itself it returns the recordset....however im getting the old error '80020009' message. I've declared the recordset outside of the function.

Cany anyone see the error in my ways?

Dim objRsTmp

Function buildList(intParentGroupID)

 Set objRsTmp = Server.CreateObject("Adodb.Recordset")
 SQLCommand = "SELECT * FROM tblGroups WHERE tblGroups.intParentGroupID = " & intParentGroupID & ";"
 objRsTmp.Open SQLCommand, strConnection, 3, 3

 If Not objRsTmp.Eof Then

  While Not objRsTmp.Eof

   Response.Write(objRsTmp("strGroup") & "<br />")

   buildList(objRsTmp("intID"))

   objRsTmp.MoveNext

  Wend

 End If

 Set buildList = objRsTmp

 '#objRsTmp.Close()
 'Set objRsTmp = Nothing

End Function

Set objRs = buildList(0)

If Not objRs.Eof Then

 Response.Write("There are records")

 While Not objRs.Eof

  For Each oFld in objRs.Fields
   Response.Write(oFld.Name & ": " & oFld.Value & ",")
  next

  Response.Write("<br />")

  objRs.MoveNext

 Wend

End If

Any assistance would be greatly appreciated.

Regards, Al

© Stack Overflow or respective owner

Related posts about asp

Related posts about recursive