I know this is FAQ but I can't seem to get this to work. I need to return the last row in the table, I'm using auto_increment which is the 'priKey' column. 'beachName' is the name of the table , 'DATEOFFILE' is the column in the table that I need to return the last value for. The println outputs
I've tried a varity of approaches using 'rs.getString(String ColumnName);' while selecting the whole row, but then I get an SQL error 'Error before start of results set' ?
If anyone can help it would be greatly appreciated.....
Code:
'DBconnect test date :::: com.mysql.jdbc.ResultSet@32fb4f'
I've tried a varity of approaches using 'rs.getString(String ColumnName);' while selecting the whole row, but then I get an SQL error 'Error before start of results set' ?
Code:
Rating atrdo = (Rating) rateingList.get(ratingCounter);
dateOfFile = atrdo.getDateOfFile();
beachName = atrdo.getBeachName();
ResultSet rs = statement.executeQuery("SELECT `DATEOFFILE` FROM `" + beachName + "` ORDER BY `priKey` DESC LIMIT 1");
String testDateT = rs.toString();
System.out.println("DBconnect test date :::: " + testDateT);
if (testDateT.equals(dateOfFile))
{
System.out.println(" File has already been downloaded today ");
statement.close();
connection.close();
}
If anyone can help it would be greatly appreciated.....