• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the result of Prepared Statement

 
Pradeeep Sharma
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have created a registration form in JSP, which takes values from user and insert it into database. In this form i am using PreparedStatement interface to execute the querry. now i want that if user fills this form and press submit button and if putting values in database got failed, than user should informed that registration failed try again. For that could any one tell me that what will be the value of 'i' after perfoming :

i=preparedStatement.executeUpdate();

if registration failed.
 
Sivaraman Lakshmanan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pradeeep,
Normally if the insert or update fails you will get a SQL Exception which you can catch and hadle it appropriately. If everything goes fine and still the row was not update you will get a return value of "0" for the method.

Please check the java documentation for more details.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic