Solved

Number of indices is less than the number of dimensions of the indexed array.

Posted on 2004-09-26
8
2,802 Views
Last Modified: 2010-05-18
Need quick help with this one if anybody can help me out.  I'm trying to send an array to a function and that's the error message I'm getting back.  I have searched all over the place and can't seem to find any help on this.  

Some small bits of the code.

public overloads function getDataSet(ByVal strSQL() as String, _
                                                ByVal strName() as String, _
                                                ByRef errMsg as String) as DataSet


 DataGrid1.datasource = mySource.getDataSet(queryStrAr(),queryNameAr(),errMsg)
             DataGrid1.DataBind()
0
Comment
Question by:tim_cs
  • 3
  • 3
  • 2
8 Comments
 
LVL 15

Expert Comment

by:Thogek
ID: 12156252
It might help to see more of how queryStrAr() and queryNameAr() are populated.
0
 
LVL 15

Expert Comment

by:Thogek
ID: 12156254
...and what line of code the error is raising on.
0
 
LVL 15

Author Comment

by:tim_cs
ID: 12156261
Ok, sorry about that.  Just a little bit in them for testing purposes.

Dim queryStrAr(1) As String
Dim queryNameAr(1) As String
queryStrAr(0) = "Select * from person"
queryNameAr(0) = "Person"
0
 
LVL 15

Author Comment

by:tim_cs
ID: 12156269
It's showing up on

DataGrid1.datasource = mySource.getDataSet(queryStrAr(),queryNameAr(),errMsg)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 28

Expert Comment

by:mmarinov
ID: 12156289
may be this is because of the you have declared the array with dfferent dimenssions ( can you post the declaration )
here is what i fond in MSDN

The number of indices used to access an array element must be exactly the same as the rank of the array, that is, the number of dimensions declared for it.

To correct this error

Add subscripts to the array reference until the total number of subscripts equals the rank of the array.

B..m
0
 
LVL 15

Accepted Solution

by:
Thogek earned 500 total points
ID: 12156304
How about:

    DataGrid1.datasource = mySource.getDataSet(queryStrAr, queryNameAr, errMsg)
0
 
LVL 28

Expert Comment

by:mmarinov
ID: 12156316
Yes, Thogek is correct - you should call the getDataSet method by passing the name of variables, not making them arrays

B..M
0
 
LVL 15

Author Comment

by:tim_cs
ID: 12156324
Yea, that got it working.  Thank you for the help.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now