dotConnect for SugarCRM Documentation
Devart.Data.Sugar Namespace / SugarException Class
Members Example

In This Topic
    SugarException Class
    In This Topic
    The exception that is generated when SugarCRM returns an error.
    Syntax
    Remarks
    This class is created whenever dotConnect for SugarCRM encounters an error generated by the server, or SugarConnection has been closed before attempting to execute an operation on the server.
    Example
    The following example generates a SugarException due to a non-existing table, and then displays the exception.
    public void ThrowSugarException()
    {
      string mySelectQuery = "SELECT * FROM NONEXISTINGTABLE";
      SugarConnection sugarConnection =
        new SugarConnection(
            "server=https://your_company.sugaropencloud.eu;user id=admin;password=AmFFA4ZryM;");
      SugarCommand sugarCommand = new SugarCommand(mySelectQuery,sugarConnection);
      try
      {
        sugarCommand.Connection.Open();
      }
      catch (SugarException myException)
      {
        MessageBox.Show("Message: " + myException.Message + "\n");
      }
    }
    Public Sub ThrowSugarException()
      Dim mySelectQuery As String = "SELECT * FROM NONEXISTINGTABLE"
      Dim sugarConnection As New SugarConnection( _
        "server=https://your_company.sugaropencloud.eu;user id=admin;password=AmFFA4ZryM;")
      Dim sugarCommand As New SugarCommand(mySelectQuery, sugarConnection)
      Try
        sugarCommand.Connection.Open()
      Catch myException As SugarException
        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.Sugar.SugarException

    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