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

    Parameters

    behavior
    One of the System.Data.CommandBehavior values.

    Return Value

    Example
    The following example creates a QuickBooksCommand, 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 CreateQuickBooksDataReader(string mySelectQuery,string quickBooksConnectionString)
    {
      QuickBooksConnection quickBooksConnection = new QuickBooksConnection(quickBooksConnectionString);
      QuickBooksCommand quickBooksCommand = new QuickBooksCommand(mySelectQuery, quickBooksConnection);
      quickBooksCommand.Connection.Open();
      QuickBooksDataReader quickBooksReader = quickBooksCommand.ExecuteReader(CommandBehavior.CloseConnection);
      while(quickBooksReader.Read())
      {
        Console.WriteLine(quickBooksReader.GetString(0));
      }
      quickBooksReader.Close();
    }
    Public Sub CreateQuickBooksDataReader(mySelectQuery As String, _
    quickBooksConnectionString As String)
      Dim quickBooksConnection As New QuickBooksConnection(quickBooksConnectionString)
      Dim quickBooksCommand As New QuickBooksCommand(mySelectQuery, quickBooksConnection)
      quickBooksCommand.Connection.Open()
      Dim quickBooksReader As QuickBooksDataReader = quickBooksCommand.ExecuteReader(CommandBehavior.CloseConnection)
      While quickBooksReader.Read()
        Console.WriteLine(quickBooksReader.GetString(0))
      End While
      quickBooksReader.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