Hi.
I work with this settings:
UniConnection.AutoCommit = false
UniQuery.Connection = UniConnection
UniQuery.Transaction = <default> (no specific UniTransaction in this application)
UniQuery.DefaultCloseAction = taRollback (don't think this matters here)
When I edit a value and scroll to next or prior with a navigator row without posting, the database is still updated. How can I avoid this behaviour? On scrolling without posting changes should not be posted or give a message to post or discard changes.
Thanks a lot for your help
M.
UniDAC Connection Autocommit False not working
-
- Posts: 10
- Joined: Mon 15 Feb 2016 22:54
Re: UniDAC Connection Autocommit False not working
Please specify the database you are working with.
-
- Posts: 10
- Joined: Mon 15 Feb 2016 22:54
Re: UniDAC Connection Autocommit False not working
Ups, sorry... MySQL


Re: UniDAC Connection Autocommit False not working
Working with MySQL server, the TUniConnection.AutoCommit property is not used. If you change data (e.g., insert, update, delete), it is always saved in a database automatically on calling the Post method, unless you use transactions. When using DB controls, if the dataset is in the edit mode, on navigating through records, the Post method is automatically executed. To commit or cancel changes, you can use the BeforePost event handler. For example:
Code: Select all
procedure TForm1.UniQueryBeforePost(DataSet: TDataSet);
begin
if (MessageDlg('Save changes?', mtConfirmation, [mbOk, mbCancel], 0) = mrCancel) then
DataSet.Cancel;
end;
-
- Posts: 10
- Joined: Mon 15 Feb 2016 22:54
Re: UniDAC Connection Autocommit False not working
It's working fine now.... thank you very much for the tipp about MySQL behaviour on AutoCommit 

Re: UniDAC Connection Autocommit False not working
It is good to see that the problem has been solved. Feel free to contact us if you have any further questions about IBDAC.