dotConnect for Mailchimp Documentation
Devart.Data.MailChimp Namespace / MailChimpCommand Class / ExecuteReader Method / ExecuteReader() Method
Example

On this page
    ExecuteReader() Method
    On this page
    Sends the CommandText to the Connection and builds a MailChimpDataReader.
    Syntax
    'Declaration
     
    Public Overloads Shadows Function ExecuteReader() As MailChimpDataReader
    public new MailChimpDataReader ExecuteReader()

    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.
    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();
      try
      {
        while(mailChimpReader.Read())
        {
          Console.WriteLine(mailChimpReader.GetString(0));
        }
      }
      finally
      {
        mailChimpReader.Close();
        mailChimpConnection.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()
      Try
        While mailChimpReader.Read()
          Console.WriteLine(mailChimpReader.GetString(0))
        End While
      Finally
        mailChimpReader.Close()
        mailChimpConnection.Close()
      End Try
    End Sub
    See Also