dotConnect for PostgreSQL Documentation
Devart.Data.PostgreSql Namespace / PgSqlRow Class / Item Property / Item(String) Property
Name of the attribute to get value for.
Example

In This Topic
    Item(String) Property
    In This Topic
    Gets or sets the value of the attribute with the specified name.
    Syntax
    'Declaration
     
    Public Overloads Property Item( _
       ByVal Name As String _
    ) As Object
    public object Item( 
       string Name
    ) {get; set;}

    Parameters

    Name
    Name of the attribute to get value for.

    Property Value

    Value of the attribute with the specified name.
    Example
    This sample demonstrates usage of Item property. It retrieves data from a column of composite type in a table and renders the data to console. To run the samples successfully you have to create server objects with the following script: CREATE TYPE tperson AS (name text, age integer); CREATE TABLE personnel (id integer, person tperson);
    static void ReadData(PgSqlConnection conn)  
    { 
      string str = "SELECT * FROM personnel"; 
      PgSqlCommand pgCommand = new PgSqlCommand(str,conn); 
      PgSqlDataReader pgReader = pgCommand.ExecuteReader(); 
      while (pgReader.Read())  
      { 
        Console.Write(pgReader.GetInt32(0) + "\t"); 
        PgSqlRow pgRow = pgReader.GetPgSqlRow(1);
        if (pgRow == null) 
        {
          Console.WriteLine();
          continue;
        }
        Console.Write(pgRow[0] + "\t");
        Console.WriteLine(pgRow["age"]);
      } 
      pgReader.Close(); 
    }
    Sub ReadData(ByVal conn As PgSqlConnection)
      Dim str As String = "SELECT * FROM personnel"
      Dim pgCommand As PgSqlCommand = New PgSqlCommand(str, conn)
      Dim pgReader As PgSqlDataReader = pgCommand.ExecuteReader()
      While pgReader.Read()
        Console.Write(pgReader.GetInt32(0) & Chr(9))
        Dim pgRow As PgSqlRow = pgReader.GetPgSqlRow(1)
        If pgRow Is Nothing Then
          Console.WriteLine()
        Else
          Console.Write(pgRow(0) & Chr(9))
          Console.WriteLine(pgRow("age"))
        End If
      End While
      pgReader.Close()
    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