Using the DataWindow Transaction Object control
What it does
The DataWindow Transaction Object control allows you to establish
a database connection independent of the Web ActiveX. It is similar
to the PowerBuilder Transaction object.
Internal transaction management or separate Transaction object
Both the Web ActiveX control and the Transaction Object control
can establish a database connection. The one you use depends on
your needs.
There are two main reasons to use the Transaction Object control:
- You can make one database connection for several
Web ActiveX controls, saving the overhead of multiple connections. - You can control transaction processing with Connect and Disconnect methods,
equivalent to the SQL statements CONNECT and DISCONNECT. If
the AutoCommit property is set to false, you
can control when an update is committed or rolled back (by calling
the Commit and Rollback methods).
If you have only one control and are simply retrieving data,
you do not need either of these features. Instead of instantiating
a separate control, you can set the connection properties of the
Web ActiveX itself and allow it to connect and disconnect for each
database access.
Status and error information
The Transaction Object control receives status information
from the database. You can test the success or failure of a database
operation and get status information with these methods, which are
equivalent to PowerBuilder transaction object properties:
- GetSQLCode
- GetDBCode
- GetSQLErrText
- GetSQLNRows
- GetSQLReturnData
Hiding the Transaction Object control
The Transaction Object control has no visual aspect, but if
it is in the BODY section of the Web page, it still takes up space.
You can set its HEIGHT and WIDTH attributes to very small values
or use stylesheet settings to make it invisible.
If you put it in the HEAD section, you will not have access
to its property sheet in a PowerBuilder Web target.
For information on setting properties for making a database
connection, see “Making database connections”.