dotConnect for Salesforce Marketing Cloud Documentation
Devart.Data.ExactTarget Namespace / ExactTargetCommand Class / ExecuteReader Method / ExecuteReader(CommandBehavior) Method
One of the System.Data.CommandBehavior values.
Example

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

Parameters

behavior
One of the System.Data.CommandBehavior values.

Return Value

Example
The following example creates a ExactTargetCommand, 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 CreateExactTargetDataReader(string mySelectQuery,string exactTargetConnectionString)
{
  ExactTargetConnection exactTargetConnection = new ExactTargetConnection(exactTargetConnectionString);
  ExactTargetCommand exactTargetCommand = new ExactTargetCommand(mySelectQuery, exactTargetConnection);
  exactTargetCommand.Connection.Open();
  ExactTargetDataReader exactTargetReader = exactTargetCommand.ExecuteReader(CommandBehavior.CloseConnection);
  while(exactTargetReader.Read())
  {
    Console.WriteLine(exactTargetReader.GetString(0));
  }
  exactTargetReader.Close();
}
Public Sub CreateExactTargetDataReader(mySelectQuery As String, _
exactTargetConnectionString As String)
  Dim exactTargetConnection As New ExactTargetConnection(exactTargetConnectionString)
  Dim exactTargetCommand As New ExactTargetCommand(mySelectQuery, exactTargetConnection)
  exactTargetCommand.Connection.Open()
  Dim exactTargetReader As ExactTargetDataReader = exactTargetCommand.ExecuteReader(CommandBehavior.CloseConnection)
  While exactTargetReader.Read()
    Console.WriteLine(exactTargetReader.GetString(0))
  End While
  exactTargetReader.Close()
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