Revision as of 16:41, 22 March 2011 by Han84 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
/**
 * Get the number of rows of the ResultSet object.
 * @param rs the ResultSet object
 * @return the number of rows of the ResultSet object
 */
public static int sqlResultSetLength(java.sql.ResultSet rs) {
	int length = 0;
	try {
		rs.last();
		length = rs.getRow();
		rs.beforeFirst();
	} catch (java.sql.SQLException ex) {
		Ts.printErr(ex);
	}
	return length;
}
 
public static void printErr(java.sql.SQLException ex) {
	System.out.println("SQL State: " + ex.getSQLState());
	System.out.println("Error Code: " + ex.getErrorCode());
	Ts.printErr((java.lang.Exception) ex);
}
 
public static void printErr(java.lang.Exception ex) {
	ex.printStackTrace();
	System.exit(-1);
}


Back to JavaHowTo

Alumni Liaison

Ph.D. 2007, working on developing cool imaging technologies for digital cameras, camera phones, and video surveillance cameras.

Buyue Zhang