length of an Array

Results 1 to 2 of 2

Thread: length of an Array

  1. #1
    Join Date
    Dec 1969

    Default length of an Array

    How do I get the length of an Array in vbscript??<BR>i.e.Number of records stored in the Array

  2. #2
    Join Date
    Dec 1969

    Default UBOUND( ... )

    But if you have done<BR> &#060;%<BR> Set RS = conn.Execute("SELECT ....")<BR> records = RS.GetRows<BR> %&#062;<BR>to get the data into the array, then you need to use:<BR> &#060;%<BR> maxrow = UBound( records, 2 ) &#039; 2!!!<BR> recordCount = maxrow + 1<BR> %&#062;<BR>because the cells in the array from GetRows are accessed via<BR> &#060;%<BR> oneCellContents = records( column, row )<BR> %&#062;<BR>with "row" going from 0 to maxrow.<BR><BR>To get the number of *columns* (fields) in the array, *then* you would use<BR> &#060;%<BR> maxcolumn = UBound( records, 1 )<BR> %&#062;<BR>or simply<BR> &#060;%<BR> maxcolumn = UBound( records ) &#039; because ,1 is the default<BR> %&#062;<BR>

Posting Permissions

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