dotConnect for Zoho Desk Documentation
Devart.Data.ZohoDesk Namespace / ZohoDeskDataReader Class
Members Example

In This Topic
    ZohoDeskDataReader Class
    In This Topic
    Reads a forward-only stream of rows from Zoho Desk.
    Syntax
    Remarks
    To create a ZohoDeskDataReader, you must call the ExecuteReader method of the ZohoDeskCommand object, rather than directly using a constructor.

    System.Data.Common.DbDataReader.IsClosed and RecordsAffected are the only properties that you can call after the ZohoDeskDataReader is closed. In some cases, you must call Close before you can call RecordsAffected.

    Example
    The following example creates a ZohoDeskConnection, a ZohoDeskCommand, and a ZohoDeskDataReader. The example reads through the data, writing it out to the console. Finally, the example closes the ZohoDeskDataReader, then the ZohoDeskConnection.
    public void ReadMyData(string myConnString)  {
            ZohoDeskConnection ZohoDeskConnection = new ZohoDeskConnection(myConnString);
            ZohoDeskCommand ZohoDeskCommand = (ZohoDeskCommand)ZohoDeskConnection.CreateCommand();
            ZohoDeskCommand.CommandText = "SELECT AccountID, \"Account Name\", Phone FROM Accounts";
            ZohoDeskConnection.Open();
            ZohoDeskDataReader ZohoDeskReader = ZohoDeskCommand.ExecuteReader();
            try {
                    // Always call Read before accessing data.
                    while (ZohoDeskReader.Read()) {
                    Console.WriteLine(ZohoDeskReader.GetString(0) + " " + 
                    ZohoDeskReader.GetString(1) + " " + ZohoDeskReader.GetString(2));
            }
            }
            finally {
                    // always call Close when done reading.
                    ZohoDeskReader.Close();
    
                    // Close the connection when done with it.
                    ZohoDeskConnection.Close();
            }
    }
    Public Sub ReadMyData(ByVal myConnString As String)
            Dim ZohoDeskConnection As New ZohoDeskConnection(myConnString)
            Dim ZohoDeskCommand As ZohoDeskCommand = ZohoDeskConnection.CreateCommand()
                    ZohoDeskCommand.CommandText = "SELECT AccountID, \"Account Name\", Phone FROM Accounts"
            ZohoDeskConnection.Open()
            Dim ZohoDeskReader As ZohoDeskDataReader = ZohoDeskCommand.ExecuteReader()
            Try
                    ' Always call Read before accessing data.
                    While ZohoDeskReader.Read()
                            Console.WriteLine(String.Concat(ZohoDeskReader.GetString(0), " ", _
                            ZohoDeskReader.GetString(1), " ", ZohoDeskReader.GetString(2)))
                    End While
            Finally
                    ' always call Close when done reading.
                    ZohoDeskReader.Close()
    
                            ' Close the connection when done with it.
                            ZohoDeskConnection.Close()
            End Try
    End Sub
    Inheritance Hierarchy

    System.Object
       System.MarshalByRefObject
          System.Data.Common.DbDataReader
             Devart.Common.DbDataReaderBase
                Devart.Data.SqlShimDataReader
                   Devart.Data.ZohoDesk.ZohoDeskDataReader

    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