Classic ASP Recursive function
- by user333411
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