December 12th, 2012, 07:51 AM
Hi all, i wanted to develop a generic method to load content of tables from my MySql database into netbeans.
What i want to know is if there is way to know how many values i get on each resultset line i have, so that with the .getString(column) i can pick each value.
The code should be like the following, as example i'll use the select *:
Inside the while i would like to make a for cicle to do:
public ResultSet FetchTable(String tablename)
String query= "SELECT * FROM " +tablename;
Statement s = conn.createStatement();
ResultSet rs = s.getResultSet();
while((rs!=null) && (rs.next()))
rs.getString(columnid), so that i could keep the method available for all classes.
Is it possible?
December 12th, 2012, 02:34 PM