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

    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 magentoConnectionString)
    {
      MagentoConnection magentoConnection = new MagentoConnection(magentoConnectionString);
      MagentoCommand magentoCommand = new MagentoCommand(mySelectQuery, magentoConnection);
      magentoCommand.Connection.Open();
      MagentoDataReader magentoReader = magentoCommand.ExecuteReader(CommandBehavior.CloseConnection);
      while(magentoReader.Read())
      {
        Console.WriteLine(magentoReader.GetString(0));
      }
      magentoReader.Close();
    }
    Public Sub CreateMagentoDataReader(mySelectQuery As String, _
    magentoConnectionString As String)
      Dim magentoConnection As New MagentoConnection(magentoConnectionString)
      Dim magentoCommand As New MagentoCommand(mySelectQuery, magentoConnection)
      magentoCommand.Connection.Open()
      Dim magentoReader As MagentoDataReader = magentoCommand.ExecuteReader(CommandBehavior.CloseConnection)
      While magentoReader.Read()
        Console.WriteLine(magentoReader.GetString(0))
      End While
      magentoReader.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