I need to check the duplicate of Email from data base.I know we can do by using text changed event or we can use jquery validations but I want in a simple format,for that ,In my database table I mentioned Unique key for Email column,if we give like that means while registering it won't allow to store duplicate value,it's worlikng very fine but the problem when I click on Register button with duplicate value ,am getting error like
Violation of UNIQUE KEY constraint 'IX_Tbl_Registration'. Cannot insert duplicate key in object 'dbo.Tbl_Registration'.
The statement has been terminated.
but instead this error I want to display a error message,so can anyone help me for this???
Joginder BangerPosted Feb 27, 2015, 10:38 AM
share your code what's you trying...
Priya AvanigaddaPosted Feb 27, 2015, 4:26 AM
Joginder BangerPosted Feb 27, 2015, 3:31 AM
you before insert the value in table check by select query like
string holdEmailid= select email[columnName] from table_name where email[EmailColumnname]="your email textbox value.
if(holdEmailid!=string.empty|| holdEmailid!=null)
{
do stuff here insert value in table
}
else
{
set holdemail="duplicate"
}
I hope you understand what i am trying