Solved

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

Posted on 2004-09-26
8
2,899 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Author Comment

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

DataGrid1.datasource = mySource.getDataSet(queryStrAr(),queryNameAr(),errMsg)
0
 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

691 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