| Author |
regarding query execution
|
mahesh amber
Greenhorn
Joined: Mar 11, 2008
Posts: 7
|
|
hi to all, I am not able to get idea if we write a program in a java that executes a sql query and we dont know how many colums does this has and we have to display data along with column names please note that the query may be different and different colums for each execution
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
You will need to examine the result set's "meta" data to find out its structure. If you look at the documentation for java.sql.ResultSet you should be able to spot a way of doing this.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Srilakshmi Vara
Ranch Hand
Joined: Jul 21, 2004
Posts: 169
|
|
|
Try using ResultMetaData class which has getColumnCount() method which returns number of columns in the resultset and note that column count starts from 1.
|
 |
 |
|
|
subject: regarding query execution
|
|
|