On 8-okt-2006, at 1:46, Narinder Chandi wrote:

Can someone point out where I'm going wrong? I have a list of records
displayed in a list box from which I can double click to open records for
editing in a new window. Each window is opened in its own thread and I
explicitly start a transaction. For the first record opened its OK, but when trying to open a second record (in a new thread in a new window) I get this
error :

"Cannot start a transaction within a transaction"

Hi Narinder,

Here are a few tips:

1. Forget all you learned about 4D. Things like processes, process variables, interprocess variables do not apply to RB.

2. RB threads are not equal to 4D processes. A 4D process has its won variable table (process variables). A thread has not. It has acces to all the variables in your application.

3. There is no sense in opening a new window in its own thread. If you use something like "Window1.Show" the thread would end right after the window is opened (assuming there is no other code after that line). Yes in 4D you would launch a new process to have multiple windows to interact with. But that is not needed in RB. In RB you will mostly use threads to do background processing.

4. In 4D each process had its own editing context (selection of records, transactions etc.) There is no real equivalent when working with SQL databases. Each recordset can be considered a selection. In order to have multiple (individual) transactions you need multiple connections.

5. Don't use transactions as an undo-mechanism as you would in 4D. Instead store all the relevant data in memory and let the user edit it. Once the user clicks the save button, you start a transaction update the relevant records and commit (or rollback) the transaction. This way you keep your transactions short and lock records only for a short while.

HTH,

- Rob Laveaux

--------------------------------------------------------
Pluggers Software
Thijssestraat 203
2521 ZG  Den Haag
The Netherlands

Email: [EMAIL PROTECTED]
Website: http://www.pluggers.nl

--------------------------------------------------------


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to