0

I get an error like this:

A first chance exception of type 'Npgsql.PostgresException' occurred in mscorlib.dll

Additional information: External component has thrown an exception.

while trying to update a table with duplicated Primary Key .

Problem is, I can't catch it even with a try-catch block.

try
    {
      res = cmd.ExecuteNonQuery();
    }
    catch (Exception e)
    {
      if (conn.State != ConnectionState.Closed)
      {
        conn.Close();
      }
    }

I just want to show a MessageBox when I get the Exception so the user knows which table didn't change

UPDATE: enter image description here

0 Answers0