[Gambas-user] Use of db.Begin, db.Commit and db.Rollback with a datasource and datacontrols

T Lee Davidson t.lee.davidson at ...626...
Tue Jan 20 20:07:32 CET 2015


I believe I have mislead you too, Lewis. My apologies.

Look at DataSource.Update.


Lee
__________

"Artificial Intelligence is no match for natural stupidity."

On 01/20/2015 01:03 PM, Lewis Balentine wrote:
> Mr. Speaker,
> I request permission to revise and extend my previous remarks ...
>
> Please see the attached sample application and data base. I used a SQlite Database but in theory these function should operate the same. I tried
> five ways to cancel the edits to a set of data controls.
>      via Control Refresh
>      via Data Source Refresh
>      via Data Source Cancel
>      via Closing the DB and reopening it
>      via Data Control Tags
>
> The only one that I found that worked was to restore the content from a copy saved in the data control tags. I note that changing the
> 'DataControl.Value' (either via software or manually) does not set 'DataSource.Modified' or "DataControl.Modified' properties to true. The
> operation was the same in version 3.6.2 and 3.6.9.
>
> Then again maybe I am doing something(s) wrong .... :-\
>
> Regards,
>
> Lewis Balentine
>
> On 01/19/2015 07:42 PM, T Lee Davidson wrote:
>> Hello Martin,
>>
>> If you are working with only one record at a time, you don't need to use transactions.
>> Transactions are used when multiple records need to be modified in an all-or-none scenario, such as when a record, that is the "one" in a
>> one-to-many relationship, needs to be deleted.
>>
>> In such a case, you would start a transaction with .Begin, delete the dependent records followed by the one record. Then, if all modifications
>> are successful, you would .Commit. If there is a failure at any time during the transaction, you would .Rollback.
>>
>> To get the datacontrol to display the original data after a canceled edit, use the .Refresh method.
>>
>>
>> Lee
>> __________
>>
>
>
>
> ------------------------------------------------------------------------------
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> http://p.sf.net/sfu/gigenet
>
>
>
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list