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

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()
LVL 15
tim_csAsked:
Who is Participating?
 
ThogekCommented:
How about:

    DataGrid1.datasource = mySource.getDataSet(queryStrAr, queryNameAr, errMsg)
0
 
ThogekCommented:
It might help to see more of how queryStrAr() and queryNameAr() are populated.
0
 
ThogekCommented:
...and what line of code the error is raising on.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
tim_csAuthor Commented:
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
 
tim_csAuthor Commented:
It's showing up on

DataGrid1.datasource = mySource.getDataSet(queryStrAr(),queryNameAr(),errMsg)
0
 
mmarinovCommented:
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
 
mmarinovCommented:
Yes, Thogek is correct - you should call the getDataSet method by passing the name of variables, not making them arrays

B..M
0
 
tim_csAuthor Commented:
Yea, that got it working.  Thank you for the help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.