DB2®ResultSet.ReadAbsolute Method

Moves the DB2ResultSet to the record indicated by the specified position, if the cursor is scrollable.

Namespace:
IBM.Data.DB2
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax


[Visual Basic]
Public Function ReadAbsolute (Integer position) As Boolean
[C#]
public bool ReadAbsolute (long position)
[C++]
public:
bool ReadAbsolute (long position)
[JScript]
public function ReadAbsolute (position: Integer) : Boolean

Parameters

position
The position of the row relative to the beginning of the result set.

Return value

true if the newly assumed position has a record (regardless if it was deleted); otherwise, false.

Example

[C#] The following example demonstrates how to determine if the DB2ResultSet instance is scrollable, and then how to read a particular row based on its position in the result set.

[C#]
  public static string getSalesData(DB2Connection conn)
  {
    string salesQuery = "SELECT * FROM SALES";
    string salesData = "";
    DB2Command cmd = new DB2Command(salesQuery, conn);
    DB2ResultSet salesRS = cmd.ExecuteResultSet(
      DB2ResultSetOptions.Scrollable |
      DB2ResultSetOptions.Sensitive |
      DB2ResultSetOptions.SkipDeleted);

    if (salesRS.Scrollable)
    {
      if (salesRS.ReadAbsolute(3))
      {
        salesData = salesRS.GetDB2Date(0).ToString();
        salesData += ", " + salesRS.GetDB2String(1).ToString();
        salesData += ", " + salesRS.GetDB2String(2).ToString();
        salesData += ", " + salesRS.GetDB2Int32(3).ToString();
      }
    }

    return salesData;
}