Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invalid Descriptor Index with multidimension array

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would like to know why I get an error with:
while(rs.next()){
for(int i = 1; i < radio.length; i++){//
obj = rs.getObject(radio[i][0]);
}
}
I know it has something to do with the radio[i][0] multi-dimension array but unsure as to why.
I thank you in advance for all your help. I really appreciate it.
Yoo-Jin.
 
Milind Kulkarni
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lee,
When you are dealing with multi-diamensional arrays you would want to write the code in the following manner:
I have written a general example which may not be necessarily applicable to your question. I have defined a 2-D array and here is how I would use length property of an array:
// Initialize and create a 2 D array
int[][] a1 = {
{ 1, 2, 3, },
{ 4, 5, 6, },
};
Use length property of array
for(int i = 0; i < a1.length; i++){
for(int j = 0; j < a1[i].length; j++){
System.out.println ("a1[" + i + "][" + j + "] = " +
a1[i][j]);}}


Hope this helps !!
Regards,
Milind

[This message has been edited by Milind Kulkarni (edited July 17, 2000).]
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Yoo-Jin, Lee:
Hi,
I would like to know why I get an error with:
while(rs.next()){
for(int i = 1; i < radio.length; i++){//
obj = rs.getObject(radio[i][0]);
}
}
I know it has something to do with the radio[i][0] multi-dimension array but unsure as to why.
I thank you in advance for all your help. I really appreciate it.
Yoo-Jin.

What is the exact error you are getting? Is it an SQL Error? This looks like the error returned when the string supplied to the getXXX of ResultSet doen't match the column name correctly. Check all the values in your array to ensure the values match the column names in your select statement.
I hope this helps!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic