What it does
The DataWindow Transaction Object control allows you to establish a database connection independent of the DataWindow Web control. It is similar to the PowerBuilder Transaction object.
Internal transaction management or separate Transaction object
Both the Web 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 DataWindow Web 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 with Commit and Rollback methods.
If you have only one control and are simply retrieving data, you don't need either of these features. Instead of instantiating a separate control, you can set the connection properties of the DataWindow Web control 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 style sheet settings to make it invisible. If you put it in the HEAD section, you won't have access to its custom property dialog in PowerSite. For information on setting properties for making a database connection, see "Making database connections".
|