Sunday, September 7, 2008

Check for duplicate records before executing INSERT

The following code may handle the exception when insert the duplicate records

protected void SqlDataSource1_Inserted(object sender, SqlDataSourceStatusEventArgs e)
{
if (e.Exception != null)
{
//handle error or display message on label or something here
}
}

0 Comments: