DB2®ResultSet.Updatable Property
Gets a value indicating if the DB2ResultSet instance can be updated.
- Namespace:
IBM.Data.DB2
- Assembly:
IBM.Data.DB2
(inIBM.Data.DB2.dll
)
Syntax
[Visual Basic]
Public Property Updatable As Boolean
[C#]
public bool Updatable {get;}
[C++]
public: __property bool get_Updatable();
[JScript]
public function get Updatable() : Boolean;
Property value
true
if
the DB2ResultSet can be updated; otherwise, false
.
Remarks
Depending on the data server your application is connected to, the attributes of the DB2ResultSet instance can be different than what the application assigned them to be in the DB2Command.ExecuteResultSet method. Use this property to verify that this DB2ResultSet instance is updatable.
Example
[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;
}