Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7064371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:49:34+00:00 2026-05-28T04:49:34+00:00

To enhance performance and resources, I’ve just started to use getRows() on a few

  • 0

To enhance performance and resources, I’ve just started to use getRows() on a few of my scripts. I have just come across an issue, which I’d like to ask about.

I was doing this to get the recordset and to get the count:

If NOT rs.EOF Then
    arrResultSet = rs.GetRows()
    arrRowCount = UBound(arrResultSet,2)
End If

But then I realised I was missing a record so I added 1 to my count:

If NOT rs.EOF Then
        arrResultSet = rs.GetRows()
        arrRowCount = UBound(arrResultSet,2) + 1
End If

But now I get an error later in my script when I try accessing the data array which is purely down to adding one to my count:

For iCounter = 0 to arrRowCount
    ...some code...
    If LCase(Trim(peopleWord)) = LCase(Trim(arrResultSet(1,iCounter))) Then
    ...some code...
Next

Microsoft VBScript runtime error '800a0009'
Subscript out of range: 'lcase(...)'

Any help greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:49:35+00:00Added an answer on May 28, 2026 at 4:49 am

    Your For is going from the index of 0 to the index of the arrRowCount.

    So, for example, if you have three records, you are going from 0 to 3, which is 4, right? IIRC, we used to do this: For iCounter = 0 to arrRowCount - 1

    Edit: Perhaps this example will help you. This web page details why using GetRows yields a performance improvement, so I think you’re on the right track. I have included the entire code sample, but you are interested in the part at the end. It has less code, and fewer variables, than you are using. It looks cleaner, simpler.

    ' Establish the connection object
    strConn = "[connection string goes here]"
    set dbConn = Server.CreateObject("ADO.Connection")
    dbConn.Open strConn
    
    ' Establish the recordset object
    set rsCustomers = Server.CreateObject("ADO.Recordset")
    set rsCustomers.ActiveConnection = dbConn
    
    ' Load the recordset object based on supplied query
    strSQL = "SELECT RecID, FirstName, LastName FROM Customers"
    rsCustomers.Open strSQL
    
    ' Push the results into a two-dimensional array
    dataArray = rsCustomers.GetRows()
    
    ' Cleanup the objects. We do it here instead of at the end because the data
    ' has already been placed into an array. This is an advantage in that we can release
    ' memory sooner.
    rsCustomers.Close
    set rsCustomers = nothing
    
    dbConn.Close
    set dbConn = nothing
    
    ' Retrieve the records performing business logic where necessary
    jMax = ubound(dataArray, 2)
    for j = 0 to jMax
    
        'Additional business logic here
    
    next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been attempting to enhance my GUI system written in Java to use
Hoho there. I was just trying to enhance the performance of my application (.NET
I have the following code and want to enhance the performance (maybe with LINQ
How can we enhance our serach performance in a large application that works with
I am attempting to enhance a internal web application we use. I am using
I have the 'luck' of develop and enhance a legacy python web application for
Just a quick query: I had a piece of code which compared a string
I have an legacy in house business application which is running in one JVM
I have just been thinking about the concept of view model object we create
I just came across this seemingly innocuous comment , benchmarking ArrayList vs a raw

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.