Hi, this is what I want, I connect to the database and extract the largest element of the UniqueId column and assign it an integer variable named maxID, here is my approach:
int maxID = 0;
Statement s2 = con.createStatement();
s2.execute("SELECT MAX(UniqueId) FROM MyTable");
ResultSet rs2 = s2.getResultSet(); //
while ( rs2.next() ){
maxID = rs2.getInt(0);
}
Whatever a decent way to solve this, it looks very rude using the rs2.next () while loop.
thanks
source
share