ASP print out array

arrays, asp-classic, associative, debugging

Solution

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

Problem

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

Original source