dotConnect for QuickBooks Online Documentation
Devart.Data.QuickBooks Namespace / QuickBooksException Class
Members Example

In This Topic
    QuickBooksException Class
    In This Topic
    The exception that is generated when QuickBooks Online returns an error.
    Syntax
    Remarks
    This class is created whenever dotConnect for QuickBooks Online encounters an error generated by the server, or QuickBooksConnection has been closed before attempting to execute an operation on the server.
    Example
    The following example generates a QuickBooksException due to a non-existing table, and then displays the exception.
    public void ThrowQuickBooksException()
    {
      string mySelectQuery = "SELECT * FROM NONEXISTINGTABLE";
      QuickBooksConnection quickBooksConnection =
        new QuickBooksConnection(
            "Company Id=1440905870;Refresh Token=AB11590759756UCO8O6CpRQcAMP00sIANafgS8Y4RN10rpLJNM;Token Server=file://D:\\temp\\QuickBooksToken.txt");
      QuickBooksCommand quickBooksCommand = new QuickBooksCommand(mySelectQuery,quickBooksConnection);
      try
      {
        quickBooksCommand.Connection.Open();
      }
      catch (QuickBooksException myException)
      {
        MessageBox.Show("Message: " + myException.Message + "\n");
      }
    }
    Public Sub ThrowQuickBooksException()
      Dim mySelectQuery As String = "SELECT * FROM NONEXISTINGTABLE"
      Dim quickBooksConnection As New QuickBooksConnection( _
        "Company Id=1440905870;Refresh Token=AB11590759756UCO8O6CpRQcAMP00sIANafgS8Y4RN10rpLJNM;Token Server=file://D:\\temp\\QuickBooksToken.txt")
      Dim quickBooksCommand As New QuickBooksCommand(mySelectQuery, quickBooksConnection)
      Try
        quickBooksCommand.Connection.Open()
      Catch myException As QuickBooksException
        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.QuickBooks.QuickBooksException

    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