DeleteRow – PB Docs 150

DeleteRow method (DataWindows)

Description

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

Controls

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataWindowChild object, DataStore
object

Web

Client control, server component

Web ActiveX

DataWindow control, DataWindowChild object

Syntax

[PowerBuilder]

[Web DataWindow client control and Web ActiveX]

[Web DataWindow server component]

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 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.

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.

note.png 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.

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 HTMLGen.property,
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
occurs.

Examples

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?
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x