• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Invalid Descriptor Index with multidimension array

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
What's brown and sticky? ... a stick. Or a tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic