DeletedCount

Description

Reports the number of rows that have been marked for deletion in the database.

Applies to

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataWindowChild object, DataStore object


Syntax

PowerBuilder

long dwcontrol.DeletedCount ( ) 

Argument

Description

dwcontrol

A reference to a DataWindow control, DataStore, or child DataWindow


Return value

Returns the number of rows that have been deleted from dwcontrol but not updated in the associated database table.

Returns 0 if no rows have been deleted or if all the deleted rows have been updated in the database table. DeletedCount returns -1 if it fails.

If any argument's value is null, in PowerBuilder and JavaScript the method returns null.

Usage

An updatable DataWindow control or DataStore has several buffers. The primary buffer stores the rows currently being displayed. The delete buffer stores rows that the application has marked for deletion by calling the DeleteRow method. These rows are saved until the database is updated. You can use DeletedCount to find out if there are any rows in the delete buffer.

If a DataWindow is not updatable, rows that are deleted are discarded -- they are not stored in the delete buffer. Therefore, DeletedCount returns 0 for a nonupdatable DataWindow unless a method, such as RowsCopy or RowsMove, has been used to populate the delete buffer.

Examples

Assuming two rows in dw_employee have been deleted but have not been updated in the associated database table, these statements set ll_Del to 2:

Long ll_Del
ll_Del = dw_employee.DeletedCount( )

This example tests whether there are rows in the delete buffer, and if so, updates the database table associated with dw_employee:

Long ll_Del
ll_Del = dw_employee.DeletedCount()
IF ll_Del <> 0 THEN dw_employee.Update()

See also

DeleteRow

FilteredCount

ModifiedCount

RowCount