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

    Parameters

    behavior
    One of the System.Data.CommandBehavior values.

    Return Value

    Example
    The following example creates a ZohoDeskCommand, 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 CreateZohoDeskDataReader(string mySelectQuery,string ZohoDeskConnectionString)
    {
      ZohoDeskConnection ZohoDeskConnection = new ZohoDeskConnection(ZohoDeskConnectionString);
      ZohoDeskCommand ZohoDeskCommand = new ZohoDeskCommand(mySelectQuery, ZohoDeskConnection);
      ZohoDeskCommand.Connection.Open();
      ZohoDeskDataReader ZohoDeskReader = ZohoDeskCommand.ExecuteReader(CommandBehavior.CloseConnection);
      while(ZohoDeskReader.Read())
      {
        Console.WriteLine(ZohoDeskReader.GetString(0));
      }
      ZohoDeskReader.Close();
    }
    Public Sub CreateZohoDeskDataReader(mySelectQuery As String, _
    ZohoDeskConnectionString As String)
      Dim ZohoDeskConnection As New ZohoDeskConnection(ZohoDeskConnectionString)
      Dim ZohoDeskCommand As New ZohoDeskCommand(mySelectQuery, ZohoDeskConnection)
      ZohoDeskCommand.Connection.Open()
      Dim ZohoDeskReader As ZohoDeskDataReader = ZohoDeskCommand.ExecuteReader(CommandBehavior.CloseConnection)
      While ZohoDeskReader.Read()
        Console.WriteLine(ZohoDeskReader.GetString(0))
      End While
      ZohoDeskReader.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