DB2®Record Class
Represents a single, read-only data row.
- Namespace:
IBM.Data.DB2
- Assembly:
IBM.Data.DB2
(inIBM.Data.DB2.dll
)
Inheritance hierarchy
System.Object
System.MarshalByRefObject
IBM.Data.DB2.DB2Record
Syntax
[Visual Basic]
NotInheritable Public Class DB2Record
[C#]
public sealed class DB2Record
[C++]
public __gc __sealed class DB2Record
[JScript]
public class DB2Record
Remarks
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.
Example
[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;
}
Thread safety
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.