Database control
Hi all,
I managed to connect to a database and with a resultset, i have managed to OUTPUT the data retreived from the DB to the System.out.println. However now I would like to learn how to put the results on a sort of table. I was looking on the web and I found a Datagrid for .net. ... Does java has an alternative to this?
Thanks all
[354 byte] By [
Xenobiusa] at [2007-11-27 7:41:36]

Hey all im still stuck!! Any examplish help please?
Lets say I have a result set which has already performed a successfull query.
Howcan I know:
How much columns are in the result set,
How much records and what is the name of each column.
With these 3 I can manage it but im not sure how and what to use to get these 3.
THANKS all
> How much columns are in the result set,
I usually know this because I'm the chap who wrote the query, but if
you trying to write some general purpose code, you can:
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
> How much records and what is the name of each column.
You can find column names in the ResultSetMetaData.
(Method getColumnLabel or perhaps getColumnName.)
The number of records is usually not something you need to know.
Instead, read the data into business objects, and add those to a list, or
if you are working with DefaultTableModel, create a row array or Vector
and add that to the model.
> THANKS all
Good luck.
Message was edited by:
Hippolyte