PB 中 settraansobject(sqlca)

2024-11-16 00:35:53
推荐回答(1个)
回答(1):

设置事务的和连接的
在改变了dataobject 后必须要再次设置settransobject 才行
以下是PB帮助,说的比较清楚

To use SetTransObject, write code that does the following tasks:

1 Set up the transaction object by assigning values to its fields (usually in the application's Open event).
2 Connect to the database using the SQL CONNECT statement and the transaction object (in the Open event for the application or window).
3 Call SetTransObject to associate the transaction object with the DataWindow control or DataStore (usually in the window's Open event).
4 Check the return value from the Update function and follow it with an SQL COMMIT or ROLLBACK statement, as appropriate.

If you change the DataWindow object associated with the DataWindow control (or DataStore) or if you disconnect and reconnect to a database, the connection between the DataWindow control (or DataStore) and the transaction object is severed. You must call SetTransObject again to reestablish the connect.