By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

Can PgSqlException and NpgsqlException be used interchangeably?

P: 6
I have some sophisticated error trapping using NpgsqlException.

But many of my SQL reads are in Postgresql and use PgSqlException for error trapping.

So, instead of using:
Expand|Select|Wrap|Line Numbers
  1. catch (PgSqlException ex)
  2.             { MessageBox.Show(ex.ToString()); }
I want to use
Expand|Select|Wrap|Line Numbers
  1. catch (NpgsqlException ex)
  2.      {
  3.       string errorx = UsefulTools.error_list(ex.Code);
  4.       MessageBox.Show("Error in reading table for reason " + errorx + "\n");
  5.       }
And in my 'UsefulTools.cs' I have a rather long list of error codes and what they mean.

So, will that work? Can I use NpgsqlException instead of PgSqlException?

Nov 4 '15 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.