Skip to content Skip to sidebar Skip to footer

Preventing Duplicate Values Entered By User

How do I prevent users from a inserting a duplicate value using SQL Query datatype is VarChar(50) e.g. the name field has already been defined as 'Josh', I don't want it to be able

Solution 1:

Set unique key constraint in the database field. But this would throw an SQLException which you will need to catch to display a proper error message to the user.

More on Unique keys... http://msdn.microsoft.com/en-us/library/ms191166.aspx

Post a Comment for "Preventing Duplicate Values Entered By User"