Provides multi-directional scrolling through a bindable stream of data rows from a database. In addition, DB2ResultSet instances can also insert, update, and delete rows.
System.Object
System.MarshalByRefObject
IBM.Data.DB2.DB2ResultSet
[Visual Basic]
Public Class DB2ResultSet
[C#]
public class DB2ResultSet
[C++]
public class DB2ResultSet
[JScript]
public class DB2ResultSet
Scrollable DB2ResultSet instances using dynamic cursors are only supported when accessing data servers that support dynamic cursors. Currently this includes DB2 UDB for z/OS Version 8 and DB2 Version 9.1 for z/OS.
To access a scrollable cursor in a three-tier environment, the DB2 Connect gateway must be running DB2 UDB for Linux, UNIX, and Windows Version 8, or DB2 database for Linux, UNIX, and Windows Version 9.
The DB2ResultSet class enables you to deploy scrollable and updatable streams of data rows in your applications. This provides a flexible alternative to using a DB2DataReader for reading data from a data server. More significantly, this provides a high-performance alternative to using a DataSet with a DB2DataAdapter for the binding of application controls to a data server.
Creating a DB2ResultSet instance is similar to creating a DB2DataAdapter: from a connected DB2Command instance, the DB2Command.ExecuteResultSet method will return a DB2ResultSet. You can set various options in the DB2Command.ExecuteResultSet methods to determine the capabilities of a DB2ResultSet.
[C#] The following example demonstrates how to read data from a scrollable DB2ResultSet that is sensitive to inserts, updates, and deletes from other applications.
[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.ReadLast())
{
salesData = salesRS.GetDB2Date(0).ToString();
salesData += ", " + salesRS.GetDB2String(1).ToString();
salesData += ", " + salesRS.GetDB2String(2).ToString();
salesData += ", " + salesRS.GetDB2Int32(3).ToString();
}
}
return salesData;
}
Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.