Friday, July 18, 2008

Updating database records

Its always best practice to use executeUpdate() method instead of executeQuery().

Returns either the row count for INSERT, UPDATE, or DELETE statements or 0 for SQL statements that return nothing

updateFlag =objPreparedStmt.executeUpdate();

if(updateFlag==1) objRequestDTO.setReqStatusForMsg(1);

We can make use of the returned value to set status.