I'm running an SQL stored procedure which inserts records into a table from 2 different tables. Since there is a primary key constraint on the table that is being inserted, the exception Duplicate key was ignored raises. But when I call the SP from my C# windows form application this raises the exception and the execution stops. How do I handle this? My C# code is below:
qry = "Exec Database.dbo.spname '" + searchvalue + "'";
if (rs.State == 1) {
rs.Close();
}
rs.Open(qry, sqltbl.GetSqlConnection());
I get an exception error on the rs.Open line