Handling unique constraints in asp.net RRS feed

  • Question

  • User-659109934 posted

    Hi Folks,

    I have table in SQL Server which has two columns that must be unique (Email Address, and Username), I am traying to find a way to handle their uniqueness seprately.

    What I mean is if a user wants to register and key in an email address which is NOT existed,but a username which is EXISTED, How to prompt to user that he/she has to enter a new Username?


    Wednesday, May 14, 2014 9:40 PM


  • User-821857111 posted

    I can think of a number of ways:

    1. Fire AJAX requests for each value and test them separately

    2. Try to insert both values and pick the Exception message for details on which one is already in there

    2. Create a stored procedure that tests each value individually and returns a formatted message if either are already present

    My preference is to have an AJAX request wired up to the change event of the form field and to let the user know if they need to change the supplied value before they submit the form. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 15, 2014 2:23 AM