?
Solved

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

Posted on 2004-09-26
8
Medium Priority
?
2,927 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
Technology Partners: 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 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

800 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