Displaying Two Dimensional Arrays

Results 1 to 2 of 2

Thread: Displaying Two Dimensional Arrays

  1. #1
    Join Date
    Dec 1969

    Default Displaying Two Dimensional Arrays

    Hi,<BR><BR>I retrieved the following SQL statement into a two-dimensional array using GetRows():<BR><BR>LocSQL = "SELECT Region_Id, Region_Name_e FROM Regions ORDER BY Region_Name_e"<BR>SET rsLoc = Conn.Execute(LocSQL)<BR><BR>arrRegionList = rsLoc.GetRows()<BR>SET rsLoc = NOTHING<BR><BR>This will return a list of regions. How do I loop through this 2 dimensional array to display each region info? Putting it through a For Each... loop splits everything so that the Region_Id is no longer associated with its Region_Name_e. I&#039ve tried:<BR><BR>&#060;% FOR EACH arrRegionInfo IN arrRegionList<BR> Response.Write arrRegionInfo & "<BR>"<BR>NEXT %&#062;<BR><BR>Which displays:<BR><BR>5<BR>Middle East<BR>1<BR>America<BR>etc.<BR><BR>How do I make it so that the Region_Id is still associated with its Region_name_e?<BR><BR>-Ben

  2. #2
    Join Date
    Dec 1969

    Default RE: Displaying Two Dimensional Arrays

    sub Display2DArray(theDataArray)<BR> <BR>if isArray(theDataArray) then<BR> Dim i, j<BR> Response.Write "&#060;TABLE WIDTH=""100%"" BORDER=""1""&#062;"<BR> for i = 0 to UBound(theDataArray, 2)<BR> Response.Write "&#060;TR&#062;"<BR> for j = 0 to UBound(theDataArray, 1)<BR> Response.Write "&#060;td&#062;"<BR> Response.Write theDataArray(j, i)<BR> Response.Write "&#060;/td&#062;"<BR> next<BR> Response.Write "&#060;/tr&#062;"<BR> next<BR> Response.Write "&#060;/table&#062;"<BR> end if<BR>end sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts