Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java and resultset 1

Status
Not open for further replies.

lowbk

Technical User
Nov 26, 2001
162
SG
suppose i receive a resultset from some other method.
eg
(inside someclass1)
ResultSet res = someclass2.method2();

is there any way to know how other columns or the last column index for the returned resultset? i searched through the api for resultset but couldn't find any.

any tips from anyone?
 
Return a array of objects or Simply a vector from the method someclass2.method2(),where the first part of the array contains the number of columns in the result set and the second element array of the contains the Resultset.Now type cast both into there respectives and use it.
 
Hi low,
We have a method to get th column count it is as follows:
//ResultSetMetaData is an interface which have the info
//the tabe name , no columns ,column names etc

ResultSetMetaData resMetaData = res.getMetaData();


//Now use resMetaData for your work as,say column count
int column_count = resMetaData.getColumnCount();

Look at the api for further details.

srinu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top