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

    Parameters

    behavior
    One of the System.Data.CommandBehavior values.

    Return Value

    Example
    The following example creates a BigcommerceCommand, 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 CreateBigcommerceDataReader(string mySelectQuery,string bigcommerceConnectionString)
    {
      BigcommerceConnection bigcommerceConnection = new BigcommerceConnection(bigcommerceConnectionString);
      BigcommerceCommand bigcommerceCommand = new BigcommerceCommand(mySelectQuery, bigcommerceConnection);
      bigcommerceCommand.Connection.Open();
      BigcommerceDataReader bigcommerceReader = bigcommerceCommand.ExecuteReader(CommandBehavior.CloseConnection);
      while(bigcommerceReader.Read())
      {
        Console.WriteLine(bigcommerceReader.GetString(0));
      }
      bigcommerceReader.Close();
    }
    Public Sub CreateBigcommerceDataReader(mySelectQuery As String, _
    bigcommerceConnectionString As String)
      Dim bigcommerceConnection As New BigcommerceConnection(bigcommerceConnectionString)
      Dim bigcommerceCommand As New BigcommerceCommand(mySelectQuery, bigcommerceConnection)
      bigcommerceCommand.Connection.Open()
      Dim bigcommerceReader As BigcommerceDataReader = bigcommerceCommand.ExecuteReader(CommandBehavior.CloseConnection)
      While bigcommerceReader.Read()
        Console.WriteLine(bigcommerceReader.GetString(0))
      End While
      bigcommerceReader.Close()
    End Sub
    See Also