dotConnect Universal Documentation
Devart.Data.Universal Namespace / UniDataReader Class / IsClosed Property
Example

In This Topic
    IsClosed Property (UniDataReader)
    In This Topic
    Gets a value indicating whether the data reader is closed.
    Syntax
    'Declaration
     
    Public Overrides ReadOnly Property IsClosed As Boolean
    public override bool IsClosed {get;}

    Property Value

    true if the UniDataReader is closed; otherwise, false.
    Remarks
    IsClosed and RecordsAffected are the only properties that you can call after the UniDataReader is closed.
    Example
    The sample below reads all data from DataReader if it is not closed; otherwise it displays a message and some information.
    public void ProcessReader (UniDataReader myReader)
    {
      if (!myReader.IsClosed)
      {
        while (myReader.Read())
        {
          for (int i=0;i<myReader.FieldCount;i++)
          {
            Console.Write("\t"+myReader[i]);
          }
          Console.WriteLine();
        }
      }
      else
      {
        Console.WriteLine("The DataReader is closed. Rows affected in last action: "+myReader.RecordsAffected);
      }
    }
    Public Sub ProcessReader(ByVal myReader As UniDataReader)
      If Not myReader.IsClosed Then
        Dim i As Integer
        While myReader.Read()
          For i = 0 To myReader.FieldCount - 1
            Console.Write(" " & myReader(i))
          Next i
          Console.WriteLine()
        End While
      Else
        Console.WriteLine("The DataReader is closed. Rows affected in last action: " & myReader.RecordsAffected)
      End If
    End Sub
    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