Represents a new row to be created in a DB2ResultSet instance.
System.Object
System.MarshalByRefObject
IBM.Data.DB2.DB2UpdatableRecord
[Visual Basic]
Public Class DB2UpdatableRecord
[C#]
public class DB2UpdatableRecord
[C++]
public class DB2UpdatableRecord
[JScript]
public class DB2UpdatableRecord
A DB2UpdatableRecord instance is created by the DB2ResultSet.CreateRecord method for the purpose of creating a new row in the result set. Once your application has populated the DB2UpdatableRecord using its Set methods, use the DB2ResultSet.Insert method, with the DB2UpdatableRecord instance as a parameter to insert the new row.
A DB2UpdatableRecord instance can only be inserted by the DB2ResultSet instance that created it.
[C#] The following example demonstrates how to insert a new row into a DB2ResultSet instance, provided the server supports updatable cursors.
[C#]
public static void insertSalesData(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 |
DB2ResultSetOptions.Updatable);
if (salesRS.Updatable)
{
DB2UpdatableRecord updatableSale = salesRS.CreateRecord();
updatableSale.SetDB2Date(0, new DB2Date(DateTime.Now));
updatableSale.SetDB2String(1, new DB2String("Erik"));
updatableSale.SetDB2String(2, new DB2String( "Ontario-South"));
updatableSale.SetDB2Int32(3, new DB2Int32(2));
salesRS.Insert(updatableSale);
}
return;
}
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.