Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP print out array

I would like to print out the data, for debugging purpose.

Data format would be like this

    cntryCode       = resArray("COUNTRYCODE")
    business        = resArray("BUSINESS") ' Payer's business name.
    shipToName      = resArray("SHIPTONAME")

the resArray consist of more than 10 records itself.

I tried to print out, but fail.

version 1 not working

public sub prArray (myarr)
    Dim x, ResponseData
    For x = 0 to myarr.Count
        ResponseData = ResponseData & myarr.Key(x) & " = " & myarr.Item(x) & "<br>"
    Next
    Response.Write ResponseData
end sub

version 2 also not working

public sub prArray (myarr)
    Dim x, ResponseData
    For x = 0 to UBound(myarr)
        ResponseData = ResponseData & myarr(x) & " = " & myarr(x) & "<br>"
    Next
    Response.Write ResponseData
end sub

I believe sure got some way to print out in classic asp

like image 498
i need help Avatar asked Jul 17 '09 08:07

i need help


1 Answers

You are using a Scripting.Dictionary no doubt. It is not ordered use this:-

 Sub prArray(myArr)
     Dim key
     For Each key in myArr
         Response.Write key & " = " & myArr.Item(key) & "<br />"
     Next
 End Sub
like image 55
AnthonyWJones Avatar answered Oct 05 '22 03:10

AnthonyWJones