Ed, If you set the item number as a primary key, the database will ensure that no duplicate records are allowed. Your JavaBean can then catch the exception and handle it appropriately. Another way to do it without causing an exception is to execute a select query on the item number before doing the insert. If the select returns a record, then you can return an error message to the user.
Regards, Richard > -----Original Message----- > From: Ed Ventura [SMTP:[EMAIL PROTECTED] > Sent: Friday, June 20, 2003 9:26 AM > To: [EMAIL PROTECTED] > Subject: Checking for duplicate records in a database. > > Is this something that you would do in the code for jsp pages or is it in > a > sql statement. I just want to check that a person doesn�t enter an item > number that already exists. > > Thanks, > Ed. > > ========================================================================== > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > JSP-INTEREST". > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST > DIGEST". > > Some relevant archives, FAQs and Forums on JSPs can be found at: > > http://java.sun.com/products/jsp > http://archives.java.sun.com/jsp-interest.html > http://forums.java.sun.com > http://www.jspinsider.com ==========================================================================To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com
