I'm saving a DataTable(dt) to database table(tblCountry) using bulkcopy. There are constraints set for tblCountry , so exceptions throw up if there is a mistake in dt.
For eg: tblCountry has CountryId as the Primary Key. If dt has 2 records with same CountryId, that would throw an exception. I would like to get that CountryId which is a duplicate, when there is an exception. Is this possible with C# or maybe Stored Procedure SqlServer 2008
protected void btnSave_Click()
SqlBulkCopy bulkcopy = new SqlBulkCopy(conn);
bulkcopy.DestinationTableName = "tblCountry";