I have the following structure
and I wanted to get the values XXX and YYY into a string which calls the RetrieveData method i.e strParam = RetrieveData(adoRS, 0, "Parameters", "Param").VB Code:
'- CONNECTION '- TYPE '- SQL ' - 'AAA' '- PARAMETERS ' - PARAM ' - 'XXX' ' - 'YYY'
'AAA' is returned into a separate string that calls the RetrieveData method i.e strSQL = RetrieveData(adoRS, 0, "SQL")
I have the following codeVB Code:
Function RetrieveData(ByVal rs As ADODB.Recordset, intIndent As Integer, _ ByVal strNode As String, _ Optional ByVal strChildNode As String) As String Dim Col As ADODB.Field Dim strReturnedSQL As String Dim rsChild As ADODB.Recordset Do While Not rs.EOF For Each Col In rs.Fields If Col.Name = strNode Then If Col.Type <> adChapter Then ' Output the non-chaptered column strReturnedSQL = Col.Value Else ' Retrieve the Child recordset Set rsChild = Col.Value rsChild.MoveFirst strReturnedSQL = RetrieveData(rsChild, intIndent + 4, strChildNode) rsChild.Close Set rsChild = Nothing End If End If Next rs.MoveNext Loop RetrieveData = strReturnedSQL rs.MoveFirst
The code currently gets the value AAA into strSQL but it has trouble getting XXX and YYY into strParams- strParams is always empty
If someone could help me adjust the loop, it would be immensely appreciated!!
thanks in advance




Reply With Quote