dotConnect for Mailchimp Documentation
Devart.Data.MailChimp Namespace / MailChimpConnection Class / CreateCommand Method
Example

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

    Return Value

    Remarks
    You can use this method as an alternative to common MailChimpCommand constructors.
    Example
    In this sample MailChimpCommand object is created. It is automatically associated with MailChimpConnection that created it.
    public void CreateMailChimpCommand(string myConnString)
    {
      MailChimpConnection mailchimpConnection = new MailChimpConnection(myConnString);
      MailChimpCommand mailchimpCommand = mailchimpConnection.CreateCommand();
      mailchimpCommand.CommandText = "INSERT INTO Folders(Name, Type) VALUES ('Sales', 'campaign')";
      mailchimpConnection.Open();
      try
      {
        mailchimpCommand.ExecuteNonQuery();
      }
      finally
      {
        mailchimpConnection.Close();
      }
    }
    Public Sub CreateMailChimpCommand(ByVal myConnString As String)
      Dim mailchimpConnection As New MailChimpConnection(myConnString)
      Dim mailchimpCommand As MailChimpCommand = mailchimpConnection.CreateCommand()
      mailchimpCommand.CommandText = "INSERT INTO Folders(Name, Type) VALUES ('Sales', 'campaign')"
      mailchimpConnection.Open()
      Try
        mailchimpCommand.ExecuteNonQuery()
      Finally
        mailchimpConnection.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