dotConnect for Salesforce Marketing Cloud Documentation
Devart.Data.ExactTarget Namespace / ExactTargetException Class
Members Example

ExactTargetException Class
The exception that is generated when ExactTarget returns an error.
Syntax
'Declaration
 
Public NotInheritable Class ExactTargetException 
   Inherits System.Data.Common.DbException
   Implements System.Runtime.InteropServices._ExceptionSystem.Runtime.Serialization.ISerializable 
 
Remarks
This class is created whenever dotConnect for ExactTarget encounters an error generated by the server, or ExactTargetConnection has been closed before attempting to execute an operation on the server.
Example
The following example generates a ExactTargetException due to a non-existing table, and then displays the exception.
public void ThrowExactTargetException()
{
  string mySelectQuery = "SELECT * FROM NONEXISTINGTABLE";
  ExactTargetConnection exactTargetConnection =
    new ExactTargetConnection(
        "user=MyCompanyAdmin;password=mypassword;url=https://webservice.s7.exacttarget.com/Service.asmx;");
  ExactTargetCommand exactTargetCommand = new ExactTargetCommand(mySelectQuery,exactTargetConnection);
  try
  {
    exactTargetCommand.Connection.Open();
  }
  catch (ExactTargetException myException)
  {
    MessageBox.Show("Message: " + myException.Message + "\n");
  }
}
Public Sub ThrowExactTargetException()
  Dim mySelectQuery As String = "SELECT * FROM NONEXISTINGTABLE"
  Dim exactTargetConnection As New ExactTargetConnection( _
    "user=MyCompanyAdmin;password=mypassword;url=https://webservice.s7.exacttarget.com/Service.asmx;")
  Dim exactTargetCommand As New ExactTargetCommand(mySelectQuery, exactTargetConnection)
  Try
    exactTargetCommand.Connection.Open()
  Catch myException As ExactTargetException
    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.ExactTarget.ExactTargetException

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