Best way to insert / update / delete records

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jkuiper
Posts: 138
Joined: Fri 04 Aug 2006 14:17

Best way to insert / update / delete records

Post by jkuiper » Tue 25 Nov 2008 13:14

I have a table witch contents a group of conditions connected to several groups like this
  • group condition
    001 02
    001 05
    001 07
    020 02
    020 08
For me is the best way to save the group at once and not by record.
The conditions are showed in a listbox. In the listbox items can be added / removed.
I have experienced with TMyLoader, but this component will only insert. TcrBatchmove can insert /update, but not deleted records.

I prefer using Virtualtable, because tclientdataset requires midas.dll and will not alway be loaded on pc's / notebooks.

So, can MyDAC components insert / update / delete by one click?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 26 Nov 2008 12:27

If you need to transfer record from VirtualTable to MySQL Server using MyDAC components, you should use the TCRBatchMove component. You should execute the TCRBatchMove.Execute method two times - first time in the bmAppendUpdate mode and second time in the bmDelete mode.

jkuiper
Posts: 138
Joined: Fri 04 Aug 2006 14:17

Post by jkuiper » Thu 27 Nov 2008 18:58

Thanks, but then I have to loop the query twice. For me it's a performance issue. Now I have it working with TClientdataset. with applyupdate() it will do all at once.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 01 Dec 2008 08:40

You can use the TMyQuery component directly. But if you have to use TClientDataSet, you can connect it with TMyQuery using the TDataSetProvider component.

Post Reply