RowsDiscard

Description

Discards a range of rows in a DataWindow control. Once a row has been discarded using RowsDiscard, you cannot restore the row. You have to retrieve it again from the database.

Applies to

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataWindowChild object, DataStore object


Syntax

PowerBuilder

integer dwcontrol.RowsDiscard (long startrow, long endrow, DWBuffer buffer ) 

Argument

Description

dwcontrol

The reference to a DataWindow control or child DataWindow.

startrow

The number of the first row you want to discard.

endrow

The number of the last row you want to discard.

buffer

A value of the dwBuffer enumerated datatype specifying the DataWindow buffer containing the rows to be discarded.

For a list of valid values, see DWBuffer.


Return value

Returns 1 if it succeeds and -1 if an error occurs.

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

Usage

Use RowsDiscard when your application is finished with some of the rows in a DataWindow control and you do not want an update to affect the rows in the database. For example, you can discard rows in the delete buffer, which prevents the rows from being deleted when you call Update.

Use Reset to clear all the rows from a DataWindow control.

The RowsDiscard method triggers the RowFocusChanging and RowFocusChanged events only when the row number of the current row is changed. The current row is simply a number that indicates which row is the current row. A change in the content of the row does not trigger the events if the number of the current row remains the same.

Suppose you have a DataWindow with two rows. If the current row is row 1 and RowsDiscard discards row 1, row 2 becomes the current row, but its row number also changes from 2 to 1. The events are not fired because the current row number is still row 1. If the current row is row 2 and RowsDiscard discards row 1, the events are fired because the current row number has changed from row 2 to row 1.

Examples

This statement discards all the rows in the delete buffer for dw_1. As a result if the application later calls dw_1.Update(), the DataWindow will not submit SQL DELETE statements to the DBMS for these rows:

dw_1.RowsDiscard(1, dw_1.DeletedCount(), Delete!)

See also

Reset

RowsCopy

RowsMove