A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
JDBC and Relational Databases
Avoid Duplicate entries in MySQL table
Joined: Dec 31, 2008
Dec 31, 2008 02:24:00
Please tell me how to chk for Duplicate entry message in
Eg:if i have a mobile no in a table it shud not allow me to enter the same number,instead it shud give a message "Mob no already exists"
Tarik Ansari [edited out e-mail -
Please use the forum not e-mail
[ December 31, 2008: Message edited by: Tarik Ansari ]
[ December 31, 2008: Message edited by: Jeanne Boyarsky ]
Joined: Oct 13, 2005
Dec 31, 2008 06:45:00
Welcome to JavaRanch
You could try searching for the mobile number in the database before inserting, but it is probably better to use the UNIQUE keyword in the SQL. You will get a straightforward
with error state, error code, and message.
Joined: Nov 06, 2000
Jan 02, 2009 10:50:00
If possible add the UNIQUE keyword to the table's definition for that column.
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
I agree. Here's the link:
subject: Avoid Duplicate entries in MySQL table
Form submit in Href
JMS not bound? What is this?
JQuery XML- Permission denied
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015