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

Parameters

behavior
One of the System.Data.CommandBehavior values.

Return Value

Example
The following example creates a MagentoCommand, 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 CreateMagentoDataReader(string mySelectQuery,string adobe commerceConnectionString)
{
  MagentoConnection adobe commerceConnection = new MagentoConnection(adobe commerceConnectionString);
  MagentoCommand adobe commerceCommand = new MagentoCommand(mySelectQuery, adobe commerceConnection);
  adobe commerceCommand.Connection.Open();
  MagentoDataReader adobe commerceReader = adobe commerceCommand.ExecuteReader(CommandBehavior.CloseConnection);
  while(adobe commerceReader.Read())
  {
    Console.WriteLine(adobe commerceReader.GetString(0));
  }
  adobe commerceReader.Close();
}
Public Sub CreateMagentoDataReader(mySelectQuery As String, _
adobe commerceConnectionString As String)
  Dim adobe commerceConnection As New MagentoConnection(adobe commerceConnectionString)
  Dim adobe commerceCommand As New MagentoCommand(mySelectQuery, adobe commerceConnection)
  adobe commerceCommand.Connection.Open()
  Dim adobe commerceReader As MagentoDataReader = adobe commerceCommand.ExecuteReader(CommandBehavior.CloseConnection)
  While adobe commerceReader.Read()
    Console.WriteLine(adobe commerceReader.GetString(0))
  End While
  adobe commerceReader.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