OnDBError

Description

Occurs if a database error takes place during processing.

Applies to

PSWebDataWindowClass objects

Arguments

Argument

Description

sqlDBCode

Number corresponding to a database-specific error code. (See your DBMS documentation for the meaning of the code.)

sqlErrText

String with a database-specific error message.

sqlSyntax

String with the full text of the SQL statement being sent to the DBMS when the error occurred.

buffer

String for the buffer containing the row involved in the database activity that caused the error.

row

Number of the row involved in the database activity that caused the error (the row being updated, selected, inserted, or deleted).

Returns

Boolean. You can set the return code to affect the type of error message displayed. By default, when the DBError event occurs in a DataWindow control, it displays a system error message. You can display your own message and suppress the system message by specifying a return code of true in the DBError event. You must include a return value in the event script.

Usage

This event is the equivalent of the DBError event for the PowerBuilder DataWindow.

Examples

Example 1

This example redirects users to a more user-friendly error page describing the database error. It passes error parameters to the new page:

PSArgClass args = new PSArgClass ( );
args.addArg ("arg1", sqlDBCode);
args.addArg ("arg2", buffer);
args.addArg ("arg3", row);
psPage.Redirect("DBErrorPage.html", args);
return true;

See also