GetUpdateStatus method (DataWindows)
Description
Reports the row number and buffer of the row that is currently
being updated in the database. When called because of an error, GetUpdateStatus reports
the row that caused the error.
Obsolete method
GetUpdateStatus is obsolete and will be
discontinued in a future release. You should replace all references
to GetUpdateStatus as soon as possible. The update
status is available as an argument in the DBError and SQLPreview events.
Controls
|
DataWindow type |
Method applies to |
|---|---|
|
PowerBuilder |
DataWindow control, DataWindowChild object |
Syntax
[PowerBuilder]
|
1 |
integer <span>dwcontrol</span>.<span>GetUpdateStatus</span> (long <span>row</span>, DWBuffer <span>dwbuffer</span> ) |
|
Argument |
Description |
|---|---|
|
dwcontrol |
A reference to a DataWindow control or |
|
row |
A variable that will store the number |
|
dwbuffer |
A value of the dwBuffer enumerated datatype |
Return Values
Returns 1 if it succeeds and –1 if an error occurs.
The number and buffer of the row currently being updated are stored
in row and dwbuffer.
If any argument value is null, the method returns null.
Examples
These statements in the script for the DBError event
for a DataWindow control obtain the text of the error message, display
a message box with the number of the row in which the error occurred
and the error message, and then make the row with the error the
current row.
Additional code in the IF statement considers
the case of the bad row being in the filter or delete buffer. If
the row is in the filter buffer, the script changes the filter so
that the user can edit the row in the primary buffer. If the row
is in the delete buffer, the message box displays a slightly different title:
|
1 |
long row_number, row_key |
|
1 |
dwBuffer buffer_type |
|
1 |
string message_text, message_title, old_filter |
|
1 |
|
1 |
// Get the error message text and set the title |
|
1 |
message_text = DBErrorMessage() |
|
1 |
message_title = "Database Error Updating Row" |
|
1 |
|
1 |
// Get the row in which the error occurred |
|
1 |
This.<span>GetUpdateStatus</span>(row_number, buffer_type) |
|
1 |
|
1 |
IF buffer_type = Filter! THEN |
|
1 |
old_filter = This.Describe("DataWindow.Filter") |
|
1 |
row_key = This.GetItemNumber(row_number, & |
|
1 |
"emp_id", Filter!, false) |
|
1 |
|
1 |
This.SetFilter("(" + old_filter + ")" + & |
|
1 |
"OR emp_id = " + String(row_key)) |
|
1 |
This.Filter() |
|
1 |
|
1 |
// Error row is now last row in primary buffer |
|
1 |
row_number = This.RowCount() |
|
1 |
|
1 |
ELSEIF buffer_type = Delete! THEN |
|
1 |
message_title = "Database Error Deleting Row" |
|
1 |
|
1 |
END IF |
|
1 |
// Display the location of the error and the error |
|
1 |
// message. |
|
1 |
MessageBox(message_title + & |
|
1 |
String(row_number), message_text) |
|
1 |
|
1 |
IF buffer_type <> Delete! THEN |
|
1 |
// Make the row with the error the current row. |
|
1 |
This.ScrollToRow(row_number) |
|
1 |
END IF |
|
1 |
// Return 1 from the DBError event |
|
1 |
// (do not display error message) because we've |
|
1 |
// already displayed a message |
|
1 |
RETURN 1 |