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

Parameters

behavior
One of the System.Data.CommandBehavior values.

Return Value

Example
The following example creates a FreshBooksCommand, 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 CreateFreshBooksDataReader(string mySelectQuery,string freshbooksConnectionString)
{
  FreshBooksConnection freshbooksConnection = new FreshBooksConnection(freshbooksConnectionString);
  FreshBooksCommand freshbooksCommand = new FreshBooksCommand(mySelectQuery, freshbooksConnection);
  freshbooksCommand.Connection.Open();
  FreshBooksDataReader freshbooksReader = freshbooksCommand.ExecuteReader(CommandBehavior.CloseConnection);
  while(freshbooksReader.Read())
  {
    Console.WriteLine(freshbooksReader.GetString(0));
  }
  freshbooksReader.Close();
}
Public Sub CreateFreshBooksDataReader(mySelectQuery As String, _
freshbooksConnectionString As String)
  Dim freshbooksConnection As New FreshBooksConnection(freshbooksConnectionString)
  Dim freshbooksCommand As New FreshBooksCommand(mySelectQuery, freshbooksConnection)
  freshbooksCommand.Connection.Open()
  Dim freshbooksReader As FreshBooksDataReader = freshbooksCommand.ExecuteReader(CommandBehavior.CloseConnection)
  While freshbooksReader.Read()
    Console.WriteLine(freshbooksReader.GetString(0))
  End While
  freshbooksReader.Close()
End Sub
See Also