BoulderBum
Programmer
I'm thinking of how I'm going to design part of a little project of mine.
The part in question is a registration page where the client selects a user name, which is then inserted (with other info) into a table (on SQL Server). Of course, I don't want duplicate user names (which are primary keys) and was hoping to handle duplicate key values via exception handling.
Is there an exception thrown under such circumstances? If so, what is its name? If I use such an approach, will the whole duplicate data insert be aborted/ will the original non-duplicate fields be in danger of being corrupted? I don't know enough about the behavior of such inserts to know if the solution I propose is viable.
The only other thing I can think of is to have a seperate query determine if a user name already exists, but that seems less efficient. Is there a better way not mentioned in my post?
The part in question is a registration page where the client selects a user name, which is then inserted (with other info) into a table (on SQL Server). Of course, I don't want duplicate user names (which are primary keys) and was hoping to handle duplicate key values via exception handling.
Is there an exception thrown under such circumstances? If so, what is its name? If I use such an approach, will the whole duplicate data insert be aborted/ will the original non-duplicate fields be in danger of being corrupted? I don't know enough about the behavior of such inserts to know if the solution I propose is viable.
The only other thing I can think of is to have a seperate query determine if a user name already exists, but that seems less efficient. Is there a better way not mentioned in my post?