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

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

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