dotConnect for Zoho Desk Documentation
Devart.Data.ZohoDesk Namespace / ZohoDeskCommand Class / ExecuteReader Method / ExecuteReader() Method
Example

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

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