dotConnect for Mailchimp Documentation
Devart.Data.MailChimp Namespace / MailChimpCommand Class / ExecuteReader Method / ExecuteReader(CommandBehavior) Method
One of the System.Data.CommandBehavior values.
Example

On this page
    ExecuteReader(CommandBehavior) Method
    On this page
    Sends the CommandText to the Connection, and builds a MailChimpDataReader using one of the System.Data.CommandBehavior values.
    Syntax
    'Declaration
     
    Public Overloads Shadows Function ExecuteReader( _
       ByVal behavior As CommandBehavior _
    ) As MailChimpDataReader
    public new MailChimpDataReader ExecuteReader( 
       CommandBehavior behavior
    )

    Parameters

    behavior
    One of the System.Data.CommandBehavior values.

    Return Value

    Example
    The following example creates a MailChimpCommand, then executes it by passing a string that is SQL SELECT statement, and a string to use to connect to the data source. The System.Data.CommandBehavior is then set to CloseConnection.
    public void CreateMailChimpDataReader(string mySelectQuery,string mailChimpConnectionString)
    {
      MailChimpConnection mailChimpConnection = new MailChimpConnection(mailChimpConnectionString);
      MailChimpCommand mailChimpCommand = new MailChimpCommand(mySelectQuery, mailChimpConnection);
      mailChimpCommand.Connection.Open();
      MailChimpDataReader mailChimpReader = mailChimpCommand.ExecuteReader(CommandBehavior.CloseConnection);
      while(mailChimpReader.Read())
      {
        Console.WriteLine(mailChimpReader.GetString(0));
      }
      mailChimpReader.Close();
    }
    Public Sub CreateMailChimpDataReader(mySelectQuery As String, _
    mailChimpConnectionString As String)
      Dim mailChimpConnection As New MailChimpConnection(mailChimpConnectionString)
      Dim mailChimpCommand As New MailChimpCommand(mySelectQuery, mailChimpConnection)
      mailChimpCommand.Connection.Open()
      Dim mailChimpReader As MailChimpDataReader = mailChimpCommand.ExecuteReader(CommandBehavior.CloseConnection)
      While mailChimpReader.Read()
        Console.WriteLine(mailChimpReader.GetString(0))
      End While
      mailChimpReader.Close()
    End Sub
    See Also