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.
Applies to
|
DataWindow type |
Method applies to |
|---|---|
|
PowerBuilder |
DataWindow control, DataWindowChild |
Syntax
PowerBuilder
|
1 |
integer dwcontrol.GetUpdateStatus (long row, DWBuffer dwbuffer ) |
|
Argument |
Description |
|---|---|
|
dwcontrol |
A reference to a DataWindow control or child |
|
row |
A variable that will store the number of the row that |
|
dwbuffer |
A value of the dwBuffer enumerated datatype |
Return value
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 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
long row_number, row_key dwBuffer buffer_type string message_text, message_title, old_filter // Get the error message text and set the title message_text = DBErrorMessage() message_title = "Database Error Updating Row" // Get the row in which the error occurred This.GetUpdateStatus(row_number, buffer_type) IF buffer_type = Filter! THEN old_filter = This.Describe("DataWindow.Filter") row_key = This.GetItemNumber(row_number, & "emp_id", Filter!, false) This.SetFilter("(" + old_filter + ")" + & "OR emp_id = " + String(row_key)) This.Filter() // Error row is now last row in primary buffer row_number = This.RowCount() ELSEIF buffer_type = Delete! THEN message_title = "Database Error Deleting Row" END IF // Display the location of the error and the error // message. MessageBox(message_title + & String(row_number), message_text) IF buffer_type <> Delete! THEN // Make the row with the error the current row. This.ScrollToRow(row_number) END IF // Return 1 from the DBError event // (do not display error message) because we've // already displayed a message RETURN 1 |
See also