Hi all, I have a jsp page that has a block of code to update a record in a mysql DB if it's there, however i'm trying to error trap it so it checks to see if the record is even in the field first before it updates. Would it be something like?
assuming null = empty set
Code:
...
else{
String query3 = "select roomnumber from table where roomnumber= ('"+roomnumber+"')";
ResultSet result3 = null;
try {
result3 = stmt.executeQuery(query3);
} catch (Exception e) {
message = "Error";
}
if ((result3 != null) && (result3.next())) {
result3 = stmt.executeQuery(query3);
if (roomnum == null) {
message = "Error: The room number was not found in the database.
}
}
...
assuming null = empty set