DB2®ResultSet.Delete Method
Deletes the current row pointed to by the DB2ResultSet.
- Namespace:
IBM.Data.DB2
- Assembly:
IBM.Data.DB2
(inIBM.Data.DB2.dll
)
Syntax
[Visual Basic]
Public Sub Delete
[C#]
public void Delete ()
[C++]
public:
void Delete ()
[JScript]
public function Delete ()
Exceptions
Exception type | Condition |
---|---|
InvalidOperationException | An updatable cursor is required. |
InvalidOperationException | No data exists for the row/column. The DB2ResulSet cursor is not positioned on a record. |
InvalidOperationException | A delete is being attempted on a row that has been deleted. |
Remarks
After deletion the cursor stays on the position of the current deleted row. All Get and Set functions will throw an exception until the cursor is moved off of the deleted row.
Example
[C#] The following example demonstrates how to delete a row from a DB2ResultSet instance, provided the server supports updatable cursors.
[C#]
public static void deleteSalesData(DB2Connection conn)
{
string salesQuery = "SELECT * FROM SALES";
DB2Command cmd = new DB2Command(salesQuery, conn);
DB2ResultSet salesRS = cmd.ExecuteResultSet(
DB2CursorType.Keyset);
if (salesRS.ReadLast())
{
if (salesRS.Updatable)
{
salesRS.Delete();
}
}
return;
}