Last post Dec 30, 2020 10:21 AM by PatriceSc
Dec 30, 2020 07:17 AM|jagjit saini|LINK
I have below code . I want even if error gets occurred in Procedure 1 , Procedure 2 should gets execute.
string Cnn = ("Server=Demo;Database=Test;uid=sa;pwd=sa");
con = new SqlConnection(Cnn);
Dec 30, 2020 10:21 AM|PatriceSc|LINK
Which kind of "error" could happen in Procedure1? Seems you are heading to using
try-catch - C# Reference | Microsoft Docs but it seems a bad design.
For example I see sometimes one that tries an insert and fallbacks to an update if it fails. It would be IMO much better to test for the primary or candidate key and act accordingly.