DeleteRow – PB Docs 150

DeleteRow method (DataWindows)


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


DataWindow type

Method applies to


DataWindow control, DataWindowChild object, DataStore


Client control, server component

Web ActiveX

DataWindow control, DataWindowChild object



[Web DataWindow client control and Web ActiveX]

[Web DataWindow server component]




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


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

Return Values

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.


DeleteRow deletes the row from the DataWindow’s primary

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.

note.png Apply GetChanges after deleting rows in a distributed

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.

Web DataWindow client control

Calling DeleteRow causes the new status
of the data to be sent back to the server where data is retrieved
again minus the deleted row. Then the page is reloaded. But you
must still call the Update method to update the database and the
data on the server.

If the DataWindow object has retrieval arguments, they must
be specified in the HTMLGen.SelfLinkArgs property. For more information,
see the,
the Retrieve method,
and the DataWindow Programmers Guide.

All methods that reload the page perform an AcceptText before
sending data back to the server. If the method fails (returns –1),
this means that pending data changes were not accepted and nothing
was sent back to the server. In this situation the ItemError event


This statement deletes the current row from dw_employee:

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

See Also

Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x