In some code I can get NotesDatabase transactions to work, other's not.
Sometimes Call db.Transactioncommit() invokes error: "TransactionBegin must be called before other Transaction methods"
But I do have a Call db.Transactionbegin() statement.
Anyone know why this would happen?
It's running on a transaction logged server.
This is what I've found in my testing:
If I have a Msgbox asking the user if they want to commit the changes this works fine.
If I replace that with a NotesUIWorkSpace.dialogBox the subsequent commit fails with the error message: "TransactionBegin must be called before other Transaction methods"
I want to use the dialogbox method to present some information to the user in a more user friendly way, before they confirm committing the changes.
Try to put transactionbegin and transaction commit after the user confirms the dialogbox. The dialogbox of course should be of type ok cancel.
Im guessing your transactionbegin is before the confirmation dialogbox and transactioncommit is after the dialogbox confirmation.
Thanks for the suggestion but the dialog box contains a summary of the changes made which the user then agrees to. So this needs to be after the begin and before the commit/rollback.
Hi Glen
Please see the comment below:
TransactionCommit can be called only after TransactionBegin. If the database being changed is allowed to go out of scope before TransactionCommit is called, all recorded changes are discarded and do not take effect.
You may like to check your code and see if the database being changed is going out of scope before , during or after your ws.dialogbox call.
Regards
I did think that might be a potential problem as my dialog box was created in a separate function and using the same/current database. However, changing the function to use the mail DB didn't resolve the problem.
It's certainly something to do with creating a dialog box because if you change it to a simple msgbox then it works.
If you could send me more details and the exact code being used, i maybe able to figure out the issue.
It's OK, I'll develop a workaround and if I get time I'll submit it as a bug to HCL.
Thanks, for trying to help though.
Just a thought, you may like to check if the dialogbox form has any initialization of db object in declaration and initialization portion. The handle to db must be obtained just once.
Yes, I did think of that but wasn't the case.. I've recoded it without the transaction now.
Thanks, for the suggestions though.