HAPPY NEW YEAR 2017

Identity And Access Management - Rajiv Dewan

Java Code to Print ResultSet

Requirement:
Print all the column name and their values in the ResultSet

Solution:
Use the below code snippet for same:

public static void printResultSet(tcResultSet result) throws tcAPIException, tcColumnNotFoundException{
for(int i = 0; i < result.getRowCount(); i++){
result.goToRow(i);
String column[] = result.getColumnNames();
for(int j = 0; j < column.length; j++){
String colName = column[j];
String value = result.getStringValue(colName);
System.out.println(colName + " --- " + value);
}}}
       

No comments:

Post a Comment