dotConnect for Zoho CRM Documentation
Devart.Data.Zoho Namespace / ZohoDataReader Class
Members Example

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

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

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

    System.Object
       System.MarshalByRefObject
          System.Data.Common.DbDataReader
             Devart.Common.DbDataReaderBase
                Devart.Data.SqlShimDataReader
                   Devart.Data.Zoho.ZohoDataReader

    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