Solved

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

Posted on 2004-09-26
8
2,827 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Asp.net mvc foreach 3 35
Getting multiple values from a dataset ASP.NET(VB) 3 37
error on the asp.net page 1 34
IIS issues - Convert to Application - APS.NET v4.0 3 24
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…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

25 Experts available now in Live!

Get 1:1 Help Now