DB2®ResultSet.Scrollable Property

Gets a value indicating if the DB2ResultSet instance is scrollable.

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

Syntax


[Visual Basic]
Public Property Scrollable As Boolean
[C#]
public bool Scrollable {get;}
[C++]
public: __property bool get_Scrollable();
[JScript]
public function get Scrollable() : Boolean;

Property value

true if the DB2ResultSet is scrollable; otherwise, false.

Remarks

Depending on the data server your application is connected to, the attributes of the DB2ResultSet instance can be different than what the application assigned them to be in the DB2Command.ExecuteResultSet method. Use this property to verify that this DB2ResultSet instance is scrollable.

Example

[C#] The following example demonstrates how to determine if the DB2ResultSet instance is scrollable, and read data from it.

[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;
}