dotConnect for PostgreSQL Documentation
Devart.Data.PostgreSql Namespace / PgSqlException Class
Members Example

In This Topic
    PgSqlException Class
    In This Topic
    The exception that is generated when PostgreSQL returns a warning or error.
    Syntax
    Remarks
    This class is created whenever dotConnect for PostgreSQL encounters an error generated by the server.

    If the severity of the error is too great, the server may close the PgSqlConnection. However, the user can reopen the connection and continue.

    Example
    The following example generates a PgSqlException due to a missing database, and then displays the exception.
    public void ThrowPgSqlException()
    {
      string mySelectQuery = "SELECT * FROM Test.Dept";
      PgSqlConnection myConnection =
        new PgSqlConnection("host=server;database=test;user id=postgres");
      PgSqlCommand myCommand = new PgSqlCommand(mySelectQuery,myConnection);
      try
      {
        myCommand.Connection.Open();
      }
      catch (PgSqlException myException)
      {
        MessageBox.Show("Message: " + myException.Message + "\n");
      }
    }
    Public Sub ThrowPgSqlException()
      Dim mySelectQuery As String = "SELECT * FROM Test.Dept"
      Dim myConnection As New PgSqlConnection _
        ("host=server;database=test;user id=postgres")
      Dim myCommand As New PgSqlCommand(mySelectQuery, myConnection)
      Try
        myCommand.Connection.Open()
      Catch myException As PgSqlException
        MessageBox.Show("Message: " + myException.Message + ControlChars.Cr)
      End Try
    End Sub
    Inheritance Hierarchy

    System.Object
       System.Exception
          System.SystemException
             System.Runtime.InteropServices.ExternalException
                System.Data.Common.DbException
                   Devart.Data.PostgreSql.PgSqlException

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also