Results 1 to 1 of 1
Thread: Tree with Database
- 12-04-2009, 05:59 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 5
- Rep Power
- 0
Tree with Database
Hi all,
I am working on the sample from java.sun.com/docs/books/tutorial/uiswing/examples/components/GenealogyExampleProject/src/components/GenealogyModel.java
Here's my while loop ,
Then I want to put it into this wayJava Code:try { String sql="Select * from folder"; st=con.createStatement(); rs=st.executeQuery(sql); list.add("Current Folders"); while(rs.next()) { String folderName = rs.getString("folder_name"); list.add(folderName); // System.out.println(folderName); //Person a1 = new Person(folderName); }
I do not know how I can assign the "Person a1, a2 depending on var i.Java Code:Object hierarchy[]=list.toArray(); for(int i=1; i<hierarchy.length; i++) { Person a+i=new Person(hierarchy[i]); }
However, if I hardcoded it as below, it works fine.
Can someone help me here?Java Code:Person a1 = new Person("Jack (great-granddaddy)"); Person a2 = new Person("Jean (great-granny)");
Thank you
Similar Threads
-
Help Tree Set
By ShuiYinDeng in forum New To JavaReplies: 2Last Post: 10-29-2009, 10:45 AM -
Creating a Tree and then saving the Tree
By jackmatt2 in forum New To JavaReplies: 0Last Post: 08-22-2009, 12:51 PM -
B tree
By wide in forum New To JavaReplies: 2Last Post: 06-30-2009, 11:37 PM -
How to convert access database to mysql database?
By vrk in forum Advanced JavaReplies: 2Last Post: 02-11-2009, 04:43 AM -
How to bind a tree with checkboxes to a database table
By happyday in forum SWT / JFaceReplies: 0Last Post: 01-20-2009, 03:28 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks