java - How to Retrieve Another Statement Records Using HashTable? -


good evening, try use hashtable() storing database table records temporarily . problem dunno why records being put inside hashtable() first record. think problem occur because of wrong loops concept, related code:

declare

hashtable hashsample = new hashtable(); 

for loop

for (i = 0; i< db.getnumberofrows(); i++) {          hashsample.put(i, db.getdata());         system.out.println(hashsample);     } 

p/s: i'm new in hashtable, db (database statement) run fine...

need hints , advised, in advanced^^

i tried code mocking db:

public static void main(string[] args) {      hashmap db = new hashmap();     db.put(0, "zero");     db.put(1, "one");     db.put(2, "two");     db.put(3, "three");      hashtable hashsample = new hashtable();      (int = 0; < db.size(); i++) {              hashsample.put(i, db.get(i));             system.out.println(hashsample);     }  } 

and works fine. here output:

{0=zero} {1=one, 0=zero} {2=two, 1=one, 0=zero} {3=three, 2=two, 1=one, 0=zero} 

the problem think db.getdata() return same thing.


Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -