dotConnect for Salesforce Marketing Cloud Documentation
Devart.Data.ExactTarget Namespace / ExactTargetConnection Class / CreateCommand Method
Example

In This Topic
    CreateCommand Method (ExactTargetConnection)
    In This Topic
    Creates and returns a ExactTargetCommand object associated with the ExactTargetConnection.
    Creates and returns a ExactTargetCommand object associated with the ExactTargetConnection.
    Syntax
    'Declaration
     
    Public Shadows Function CreateCommand() As ExactTargetCommand
    public new ExactTargetCommand CreateCommand()

    Return Value

    Remarks
    You can use this method as an alternative to common ExactTargetCommand constructors.
    Example
    In this sample ExactTargetCommand object is created. It is automatically associated with ExactTargetConnection that created it.
    public void CreateExactTargetCommand(string myConnString)
    {
      ExactTargetConnection exactTargetConnection = new ExactTargetConnection(myConnString);
      ExactTargetCommand exactTargetCommand = exactTargetConnection.CreateCommand();
      exactTargetCommand.CommandText = "INSERT INTO Email (Name, Subject) VALUES ('Sale', 'Big Sale!')";
      exactTargetConnection.Open();
      try
      {
        exactTargetCommand.ExecuteNonQuery();
      }
      finally
      {
        exactTargetConnection.Close();
      }
    }
    Public Sub CreateExactTargetCommand(ByVal myConnString As String)
      Dim exactTargetConnection As New ExactTargetConnection(myConnString)
      Dim exactTargetCommand As ExactTargetCommand = exactTargetConnection.CreateCommand()
      exactTargetCommand.CommandText = "INSERT INTO Email (Name, Subject) VALUES ('Sale', 'Big Sale!')"
      exactTargetConnection.Open()
      Try
        exactTargetCommand.ExecuteNonQuery()
      Finally
        exactTargetConnection.Close()
      End Try
    End Sub
    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