Delete a record, or mark a record for deletion.


If a record has DataRecordStatus.New, the record will immediately be deleted from the recordset. The RecordCount becomes 1 less.


If a record has DataRecordStatus.Existing, the recordstatus will be changed to DataRecordStatus.ExistingDelete. When Recordset.SaveChanges() is called, a DELETE SQL statement will be executed on the database, and only then will the record be removed from the resultset.


Resultset.Delete() without parameter will delete the currently selected record. An exception will be thrown if no current record is selected.


Resultset.Delete(int index) will delete the record at the index position.


Resultset.Delete(TRecord) will delete the specified record.


See topic DataRecordStatus (enum) for an overview of record statuses.


This method is inherited from the RecordsetData class.


public void Delete()

public void Delete(int index)

public void Delete(TRecord record)


Examples

Delete the currently selected record:


customers.Delete();


Delete the first record in the resultset:


if (customers.RecordCount > 0)

   customers.Delete(0);


Look up a record and delete it (or mark it for deletion):


customers.Delete(record);


Remarks

The DataRecordStatus be retrieved with the Record.RecordStatus() method.