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

Parameters

behavior
One of the System.Data.CommandBehavior values.

Return Value

A ZohoDataReader object.
Example
The following example creates a ZohoCommand, 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 CreateZohoDataReader(string mySelectQuery,string zohoConnectionString)
{
  ZohoConnection zohoConnection = new ZohoConnection(zohoConnectionString);
  ZohoCommand zohoCommand = new ZohoCommand(mySelectQuery, zohoConnection);
  zohoCommand.Connection.Open();
  ZohoDataReader zohoReader = zohoCommand.ExecuteReader(CommandBehavior.CloseConnection);
  while(zohoReader.Read())
  {
    Console.WriteLine(zohoReader.GetString(0));
  }
  zohoReader.Close();
}
Public Sub CreateZohoDataReader(mySelectQuery As String, _
zohoConnectionString As String)
  Dim zohoConnection As New ZohoConnection(zohoConnectionString)
  Dim zohoCommand As New ZohoCommand(mySelectQuery, zohoConnection)
  zohoCommand.Connection.Open()
  Dim zohoReader As ZohoDataReader = zohoCommand.ExecuteReader(CommandBehavior.CloseConnection)
  While zohoReader.Read()
    Console.WriteLine(zohoReader.GetString(0))
  End While
  zohoReader.Close()
End Sub
See Also