| Author |
ArrayList couldnt generate output
|
Eric Tan
Ranch Hand
Joined: Oct 11, 2006
Posts: 72
|
|
I have some problem on the coding. I followed what you said on some post. I tried on my java page. whereby i put the codes in my page and tried it out. after i run it, it couldn't display any results from the file itself when i want to retrieve the results out. this is part of the coding where the retrieve is. Maybe i am wrong in the codes that i put in. Can anyone guide me on this? Thanks
|
 |
David Nemeskey
Ranch Hand
Joined: Nov 08, 2006
Posts: 52
|
|
Hello, Are you sure this is the right forum to ask it? First of all, this is not a general java question at all, I think it should be moved to a database-related forum. Second, it seems as if you are answering to someone; wasn't your post intended as a reply, and not a new topic? Anyway, now for the question: It seems to me that you accidentally swapped the name of your variables. Also, you print all countries (called "list") one-by-one, instead of the whole list. So, didn't you want to write The code above should output all Countries in the following way: [<country1>, <country2>, .... <countryn>] However, even with the original code, it should have written something, provided there are countries in the file! So, I suggest to check if the result set is empty, like this: This will print "Result set is empty", if there are no countries in the db file. [ November 17, 2006: Message edited by: David Nemeskey ]
|
 |
Eric Tan
Ranch Hand
Joined: Oct 11, 2006
Posts: 72
|
|
Thanks alot for yourr help. Sorry about the posting on the wrong forum. Because i thought it was a java problem with arraylist. Thanks again, really appreciate it
|
 |
Eric Tan
Ranch Hand
Joined: Oct 11, 2006
Posts: 72
|
|
Thanks alot. I paste the codes and it works... Really appreciate it alot. And sorry about the wrong posting
|
 |
David Nemeskey
Ranch Hand
Joined: Nov 08, 2006
Posts: 52
|
|
You are welcome. However, I just had a look at the forums, and do not really know where you could have posted it... Seems like all database forums are relational database-related (O-R mapping, JDBC). So maybe we need an object DB, or at least a general persistence forum. I have asked it in the JavaRanch forum, well, we'll see.
|
 |
Eric Tan
Ranch Hand
Joined: Oct 11, 2006
Posts: 72
|
|
Yeah. can open one too. since the world now is emphasizing a lot on object database so i think it's time to have a forum about it to recommend people the advantage of it
|
 |
 |
|
|
subject: ArrayList couldnt generate output
|
|
|