DeletedCount method (DataWindows)
Description
Reports the number of rows that have been marked for deletion
in the database.
Controls
DataWindow type |
Method applies to |
---|---|
PowerBuilder |
DataWindow control, DataWindowChild object, DataStore |
Web |
Client control, server component |
Web ActiveX |
DataWindow control, DataWindowChild object |
Syntax
[PowerBuilder and Web DataWindow server component]
1 |
long <span>dwcontrol</span><span>.</span><span>DeletedCount</span> ( ) |
[Web DataWindow client control and Web ActiveX]
1 |
number <span>dwcontrol</span><span>.DeletedCount </span>( ) |
Argument |
Description |
---|---|
dwcontrol |
A reference to a DataWindow control, |
Return Values
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:
1 |
Long ll_Del |
1 |
ll_Del = dw_employee.<span>DeletedCount</span>( ) |
This example tests whether there are rows in the
delete buffer, and if so, updates the database table associated
with dw_employee:
1 |
Long ll_Del |
1 |
ll_Del = dw_employee.<span>DeletedCount</span>() |
1 |
IF ll_Del <> 0 THEN dw_employee.Update() |