Reset

Description

Clears all the data from a DataWindow control or DataStore object.

For the syntax to use for deleting graphs within a DataWindow object that have an external data source, see Reset. For the syntax to use with other PowerBuilder controls, see the section called “Reset” in PowerScript Reference.

Applies to

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataWindowChild object, DataStore object


Syntax

PowerBuilder

integer dwcontrol.Reset ( ) 

Argument

Description

dwcontrol

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


Return value

Returns 1 if it succeeds and -1 if an error occurs. The return value is usually not used.

If dwcontrol is null, in PowerBuilder and JavaScript the method returns null.

Usage

Reset is not the same as deleting rows from the DataWindow object or child DataWindow. Reset affects the application only, not the database. If you delete rows and then call the Update method, the rows are deleted from the database table associated with the DataWindow object. If you call Reset and then call Update, no changes are made to the table.

PowerBuilder environment

If you call Reset when the Retrieve As Needed option is set, Reset will clear the rows that have been retrieved. However, because Retrieve As Needed is on, the DataWindow immediately retrieves the next set of rows.

To prevent the rows from being retrieved, call DBCancel before calling Reset. If all the rows have been retrieved (the cursor has been closed and the RetrieveEnd event has occurred), then when Reset clears the DataWindow, it stays empty.

Examples

This statement completely clears the contents of dw_employee:

dw_employee.Reset()

In a DataWindow whose Retrieve As Needed option is on, this example cancels the retrieval before resetting the DataWindow:

dw_employee.DBCancel()
dw_employee.Reset()

See also

DeleteRow