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

Parameters

behavior
One of the System.Data.CommandBehavior values.

Return Value

Example
The following example creates a ZohoBooksCommand, 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 CreateZohoBooksDataReader(string mySelectQuery,string ZohoBooksConnectionString)
{
  ZohoBooksConnection ZohoBooksConnection = new ZohoBooksConnection(ZohoBooksConnectionString);
  ZohoBooksCommand ZohoBooksCommand = new ZohoBooksCommand(mySelectQuery, ZohoBooksConnection);
  ZohoBooksCommand.Connection.Open();
  ZohoBooksDataReader ZohoBooksReader = ZohoBooksCommand.ExecuteReader(CommandBehavior.CloseConnection);
  while(ZohoBooksReader.Read())
  {
    Console.WriteLine(ZohoBooksReader.GetString(0));
  }
  ZohoBooksReader.Close();
}
Public Sub CreateZohoBooksDataReader(mySelectQuery As String, _
ZohoBooksConnectionString As String)
  Dim ZohoBooksConnection As New ZohoBooksConnection(ZohoBooksConnectionString)
  Dim ZohoBooksCommand As New ZohoBooksCommand(mySelectQuery, ZohoBooksConnection)
  ZohoBooksCommand.Connection.Open()
  Dim ZohoBooksReader As ZohoBooksDataReader = ZohoBooksCommand.ExecuteReader(CommandBehavior.CloseConnection)
  While ZohoBooksReader.Read()
    Console.WriteLine(ZohoBooksReader.GetString(0))
  End While
  ZohoBooksReader.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