DeleteRow

Description

Deletes a row from a DataWindow control, DataStore object, or child DataWindow.

Applies to

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataWindowChild object, DataStore object


Syntax

PowerBuilder

integer dwcontrol.DeleteRow ( long row ) 

Argument

Description

dwcontrol

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

row

A value identifying the row you want to delete. To delete the current row, specify 0 for row.


Return value

Returns 1 if the row is successfully deleted and -1 if an error occurs.

If any argument's value is null, in PowerBuilder and JavaScript the method returns null. If there is no DataWindow object assigned to the DataWindow control or DataStore, this method returns -1.

Usage

DeleteRow deletes the row from the DataWindow's primary buffer.

If the DataWindow is not updatable, all storage associated with the row is cleared. If the DataWindow is updatable, DeleteRow moves the row to the DataWindow's delete buffer; PowerBuilder uses the values in the delete buffer to build the SQL DELETE statement.

The row is not deleted from the database table until the application calls the Update method. After the Update method has updated the database and the update flags are reset, the storage associated with the row is cleared.

Apply GetChanges after deleting rows in a distributed application

If a DataWindow or data store is populated using SetChanges or SetFullState, and an Update is done that includes deleted rows, the deleted rows remain in the delete buffer until a subsequent GetChanges is applied to the DataWindow or data store.

Examples

This statement deletes the current row from dw_employee:

dw_employee.DeleteRow(0)

These statements delete row 5 from dw_employee and then update the database with the change:

dw_employee.DeleteRow(5)
dw_employee.Update()

See also

DeletedCount

InsertRow