dotConnect for Salesforce Documentation
Devart.Data.Salesforce Namespace / SalesforceCommand 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 SalesforceDataReader using one of the System.Data.CommandBehavior values.
Syntax
'Declaration
 
Public Overloads Shadows Function ExecuteReader( _
   ByVal behavior As CommandBehavior _
) As SalesforceDataReader
 

Parameters

behavior
One of the System.Data.CommandBehavior values.

Return Value

Example
The following example creates a SalesforceCommand, 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 CreateSalesforceDataReader(string mySelectQuery,string salesforceConnectionString)
{
  SalesforceConnection salesforceConnection = new SalesforceConnection(salesforceConnectionString);
  SalesforceCommand salesforceCommand = new SalesforceCommand(mySelectQuery, salesforceConnection);
  salesforceCommand.Connection.Open();
  SalesforceDataReader salesforceReader = salesforceCommand.ExecuteReader(CommandBehavior.CloseConnection);
  while(salesforceReader.Read())
  {
    Console.WriteLine(salesforceReader.GetString(0));
  }
  salesforceReader.Close();
}
Public Sub CreateSalesforceDataReader(mySelectQuery As String, _
salesforceConnectionString As String)
  Dim salesforceConnection As New SalesforceConnection(salesforceConnectionString)
  Dim salesforceCommand As New SalesforceCommand(mySelectQuery, salesforceConnection)
  salesforceCommand.Connection.Open()
  Dim salesforceReader As SalesforceDataReader = salesforceCommand.ExecuteReader(CommandBehavior.CloseConnection)
  While salesforceReader.Read()
    Console.WriteLine(salesforceReader.GetString(0))
  End While
  salesforceReader.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