03
Jun
10

find the number of columns in a ResultSet



Suppose you have a ResultSet and you want to find out how many columns it holds. Here’s how you do it:


ResultSet rs = statement.executeQuery();
ResultSetMetaData metaData = rs.getMetaData();
int numberOfColumns = metaData.getColumnCount();

Advertisements

0 Responses to “find the number of columns in a ResultSet”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Blog Stats

  • 223,848 hits

%d bloggers like this: