dotConnect for Zoho CRM Documentation
Devart.Data.Zoho Namespace / ZohoCommand Class / ExecuteReader Method / ExecuteReader() Method
Example

In This Topic
    ExecuteReader() Method
    In This Topic
    Sends the CommandText to the Connection and builds a ZohoDataReader.
    Syntax
    'Declaration
     
    Public Overloads Shadows Function ExecuteReader() As ZohoDataReader
    public new ZohoDataReader ExecuteReader()

    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.
    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();
      try
      {
        while(zohoReader.Read())
        {
          Console.WriteLine(zohoReader.GetString(0));
        }
      }
      finally
      {
        zohoReader.Close();
        zohoConnection.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()
      Try
        While zohoReader.Read()
          Console.WriteLine(zohoReader.GetString(0))
        End While
      Finally
        zohoReader.Close()
        zohoConnection.Close()
      End Try
    End Sub
    See Also