Java and SQL Question

Associate
Joined
7 Nov 2003
Posts
584
Location
UK
Hi,
Im hoping there is some java gods around these parts to help me out a little.

Ive made a java program to interrogate an access database.
Code:
ResultSet result = db_statement.executeQuery("select * from "table_name" );

while (result.next() ){ 
output.setText(output.getText()+"ID : " + result.getInt("ID") "\t"+result.getString("Name")+"\n");

	}
Ok, so this works, it takes out the ID, and Name from the results. But if in another table i have more fields,i would have to add more result.getString, and result.getInt's and specify which column to get the result from. Very tedious, considering the amount of possible SQL commands i could execute. :(

So ... Does anyone know if there is a way to extract all the data that the sql command has output straight into my output TextField, without having to manually extract it with different java commands, it would save so much code and loads of my time :)

Any advice appreciated :) Thanks for your time peeps.
 
Back
Top Bottom