The DB2ResultSet class provides the ability to scroll through a bindable stream of rows that are returned from a database. You can also insert, update, and delete rows in the DB2ResultSet object.
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
The scrollable DB2ResultSet class with dynamic cursor is only supported on database servers that support the dynamic cursor.
The DB2ResultSet class is used to access streams of rows that are generated from executing a statement. The DB2ResultSet class provides a flexible alternative to using the DB2DataReader class for reading data from a database server. Use of the DB2ResultSet class provides a high-performance alternative to using a DataSet with the DB2DataAdapter class for the binding of application controls to a database server.
Creating a DB2ResultSet object is similar to creating a DB2DataAdapter object: from a connected DB2Command object, the DB2Command.ExecuteResultSet method returns a DB2ResultSet object. You can call the DB2Command.ExecuteResultSet method with specific option to determine the properties of a DB2ResultSet object.
[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.