954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

About Unique Constraint

Hello,
I want to check uniqueness of id at the time of entry only.And I want to give message to the user at that time only.How to do this?

srs_grp
Light Poster
34 posts since Sep 2008
Reputation Points: 9
Solved Threads: 0
 

Either you generate the Id and assign it to the user yourself using an autoincrement or a UUID feature, but if you want the user to select his own ID you will have to perform a check in your records (database or files) to check if the ID has already been chosen by someone else.

stephen84s
Nearly a Posting Virtuoso
1,443 posts since Jul 2007
Reputation Points: 668
Solved Threads: 154
 
Either you generate the Id and assign it to the user yourself using an autoincrement or a UUID feature, but if you want the user to select his own ID you will have to perform a check in your records (database or files) to check if the ID has already been chosen by someone else.


yes.. but the problem is where should I perform this check,so that I can immediately inform user abt constraint violation.

srs_grp
Light Poster
34 posts since Sep 2008
Reputation Points: 9
Solved Threads: 0
 

That depends, what are you working on right now, what type of application is it ? A web page, Swing form ? You want specific answers but you haven't yet given details specific to your application.

stephen84s
Nearly a Posting Virtuoso
1,443 posts since Jul 2007
Reputation Points: 668
Solved Threads: 154
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You