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

In This Topic
    ExecuteReader() Method
    In This Topic
    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
    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