dotConnect for Zoho Books Documentation
Devart.Data.ZohoBooks Namespace / ZohoBooksCommand Class / ExecuteReader Method / ExecuteReader() Method
Example

On this page
    ExecuteReader() Method
    On this page
    Sends the CommandText to the Connection and builds a ZohoBooksDataReader.
    Syntax
    'Declaration
     
    Public Overloads Shadows Function ExecuteReader() As ZohoBooksDataReader
    public new ZohoBooksDataReader ExecuteReader()

    Return Value

    Example
    The following example creates a ZohoBooksCommand, 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 CreateZohoBooksDataReader(string mySelectQuery,string zohoBooksConnectionString)
    {
      ZohoBooksConnection zohoBooksConnection = new ZohoBooksConnection(zohoBooksConnectionString);
      ZohoBooksCommand zohoBooksCommand = new ZohoBooksCommand(mySelectQuery, zohoBooksConnection);
      zohoBooksCommand.Connection.Open();
      ZohoBooksDataReader zohoBooksReader = zohoBooksCommand.ExecuteReader();
      try
      {
        while(zohoBooksReader.Read())
        {
          Console.WriteLine(zohoBooksReader.GetString(0));
        }
      }
      finally
      {
        zohoBooksReader.Close();
        zohoBooksConnection.Close();
      }
    }
    Public Sub CreateZohoBooksDataReader(mySelectQuery As String, _
    zohoBooksConnectionString As String)
      Dim zohoBooksConnection As New ZohoBooksConnection(zohoBooksConnectionString)
      Dim zohoBooksCommand As New ZohoBooksCommand(mySelectQuery, zohoBooksConnection)
      zohoBooksCommand.Connection.Open()
      Dim zohoBooksReader As ZohoBooksDataReader = zohoBooksCommand.ExecuteReader()
      Try
        While zohoBooksReader.Read()
          Console.WriteLine(zohoBooksReader.GetString(0))
        End While
      Finally
        zohoBooksReader.Close()
        zohoBooksConnection.Close()
      End Try
    End Sub
    See Also