Represents a single, read-only data row.
System.Object
System.MarshalByRefObject
IBM.Data.DB2.DB2Record
[Visual Basic]
NotInheritable Public Class DB2Record
[C#]
public sealed class DB2Record
[C++]
public __gc __sealed class DB2Record
[JScript]
public class DB2Record
For situations where you only need to retrieve a single row, a DB2Record provides performance advantages over using a DB2ResultSet or a DB2DataReader as the cursor reading the row is able to close once the DB2Record is populated.
[C#] The following example demonstrates how to create a DB2Record and read its column data.
[C#]
public static string getSalesData(DB2Connection conn)
{
string salesQuery = "SELECT MAX(SALES) FROM SALES";
string salesData = "";
DB2Command cmd = new DB2Command(salesQuery, conn);
DB2Record salesRec = cmd.ExecuteRow();
salesData = salesRec.GetDB2Int32(0).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.