SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard boxhead's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,040
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    getrows get more than rs length!!

    I am reading an recordset into an array using getrows, but my recordset has 38 records but my array has 46!!

    If I loop through the array, it errors on number 38 (as expected). I am using UBound to find the array length.

    can anyone think what is going wrong, without the need to post my code (step 2!)?

    cheers

    monkey
    monkey - the rest is history

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, are there 46 fields per record maybe?

  3. #3
    SitePoint Wizard boxhead's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,040
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    44! but i get the same figure no matter how many records are bought back.
    Last edited by boxhead; Jan 18, 2007 at 06:02.
    monkey - the rest is history

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well it's a 2 dimensional array - Im guessing that you are using the (fields per record) dimension instead of the (records per query) dimension.

  5. #5
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how are you doing the loop?

    Code:
    for i=0 to ubound(boxheadarray,2)
    try that if you're not. ",2" is the number of rows...

  6. #6
    SitePoint Wizard boxhead's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,040
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bbolte View Post
    how are you doing the loop?

    Code:
    for i=0 to ubound(boxheadarray,2)
    try that if you're not. ",2" is the number of rows...
    just the ticket - never new about the second parameter

    cheers
    monkey - the rest is history

  7. #7
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it's easily missed but i find it's needed if returning more than a single column. and just fyi, if you want to know the number of columns returned, replace the 2 with 1. as in:
    Code:
    numcols = ubound(myarray,1)
    but if you're naming your columns in the query, then one should already know...

  8. #8
    SitePoint Wizard boxhead's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,040
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bbolte View Post
    it's easily missed but i find it's needed if returning more than a single column. and just fyi, if you want to know the number of columns returned, replace the 2 with 1. as in:
    Code:
    numcols = ubound(myarray,1)
    but if you're naming your columns in the query, then one should already know...
    thanks for that - happy arraying
    monkey - the rest is history


Bookmarks

Posting Permissions

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