<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Comments for Navigating and Editing a ClientDataSet</title>
<link rel="alternate" type="text/plain" href="http://dn.codegear.com/article/29122" title="Navigating and Editing a ClientDataSet" />
<link rel="self" type="application/atom+xml" href="http://dn.codegear.com/article/29122/feed" title="Comments for Navigating and Editing a ClientDataSet" />
<id>http://dn.codegear.com/article/29122</id>
<updated>2008-07-04T13:56:06-07:00</updated>
<entry>
<title>Deleting in a nested DataSet</title>
<author>
<name>Dan Maxim</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=34566</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=34566</id>
<updated>2003-05-03T21:43:48-07:00</updated>
<published>2003-05-03T21:43:48-07:00</published>
<summary>Deleting in a nested DataSet</summary>
<content>The article is very interesting and helpful, as all the others in the series.I think an example of deleting the &quot;master&quot; record in a &quot;master-detail&quot; ( something as record n from m records, where m &gt; n &gt; 1 ) arrangement will be even more helpful. </content>
</entry>
<entry>
<title>External Exception EEFFACE with TClientDataSet Memo Field</title>
<author>
<name>AHMET AKSOY</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=34273</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=34273</id>
<updated>2003-03-14T06:33:49-07:00</updated>
<published>2003-03-14T06:33:49-07:00</published>
<summary>External Exception EEFFACE with TClientDataSet Memo Field</summary>
<content>Hi,After reading your excellent &quot;Client Data Set&quot; articles, I started to try to use TClientDataSets on D7 Pro on Win2K.Firstly, I tried converting some of my old projects using BDE components (BDE 5.01).But, recently I found an interesting problem, which I couldn't solve yet.I have an MSACCESS table with a TMemo field. There are hundreds of records in the table, and most of the Memo fields contain a large amount of data. Before using a TClientDataSet, I had no problems with that table.I import the table contents to a TClientDataSet, with a TDataSetProvider and a TQuery. I display the contents on a form using a TDBGrid, and a TDBMemo.If I make any changes in the TDBMemo field which contains a data which is larger than 256 bytes, ClientDataSet1.ApplyUpdates(-1) function doesn't work. It only updates the database if the memo field contains data which is shorter than 256 bytes.After adding the &quot;Reconcile Error Dialog&quot; Module on my project, I obtained the actual problem as: External Exception EEFFACE.How can I solve this problem? Is it impossible to use Memo fields larger than 256 bytes with TClientDataSet component and MSACCESS tables?Thanks in Advance.Ahmet Aksoy </content>
</entry>
<entry>
<title>It depends on the implicit contract</title>
<author>
<name>Ian Marteens</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=33238</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=33238</id>
<updated>2002-09-30T17:41:50-07:00</updated>
<published>2002-09-30T17:41:50-07:00</published>
<summary>It depends on the implicit contract</summary>
<content>But most of the times, at least in real world programming, you want this code to update all or nothing.</content>
</entry>
<entry>
<title>re: ... and then, there's another problem...</title>
<author>
<name>Mark Shapiro</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=33231</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=33231</id>
<updated>2002-09-30T05:32:20-07:00</updated>
<published>2002-09-30T05:32:20-07:00</published>
<summary>re: ... and then, there's another problem...</summary>
<content>&quot;The problem has to do with a try/except inside a while loop: it's very inefficient! You could achieve a similar result by moving out the try/except from the loop, like this:&quot;Not exactly.  In your example, if an exception is raised, the loop will exit, and any remaining records will not be processed.  In Mr. Jensen's code, if a record cannot be edited (for ANY reason), it will be skipped, but remaining records will still be processed.  Moving the CDS1.Cancel outside the loop changes the operation of the routine.</content>
</entry>
<entry>
<title>A note on BeginUpdate/EndUpdate</title>
<author>
<name>Mark Shapiro</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=33230</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=33230</id>
<updated>2002-09-30T05:27:39-07:00</updated>
<published>2002-09-30T05:27:39-07:00</published>
<summary>A note on BeginUpdate/EndUpdate</summary>
<content>When you have called BeginUpdate on a TDataSet (of any sort - not just a TClientDataSet), the BeforeScroll and AfterScroll events DO still fire for EACH record that is scrolled through.  In some cases, this is the desired behavior.  In other cases, though, I have found that I do not want these events to fire when controls are disabled.  The are two quick ways to accomplish this:  1) Set the BeforeScroll and AfterScroll events to nil when calling BeginUpdate, and reassign them when calling EndUpdate.  2) In the *Scroll event, check DataSet.ControlsDisabled - if it is true, exit or otherwise skip the code.There is a drawback to doing this, however.  When you call EnableControls, the scroll events will NOT fire.  If you have code in the scroll events that needs to be executed, you will need to manually call the event handler.</content>
</entry>
<entry>
<title>... and then, there's another problem...</title>
<author>
<name>Ian Marteens</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=33226</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=33226</id>
<updated>2002-09-29T11:01:19-07:00</updated>
<published>2002-09-29T11:01:19-07:00</published>
<summary>... and then, there's another problem...</summary>
<content>... in that method gain. The inner try/except is supossed to bring back the dataset to dsBrowse state from the dsEdit state (and it's missing a raise in the except clause). The problem has to do with a try/except inside a while loop: it's very inefficient! You could achieve a similar result by moving out the try/except from the loop, like this:   CDS1.First;   try     while not CDS1.Eof do     begin       CDS1.Edit;       // whatever...       CDS1.Post;       CDS1.Next;     end;   except     CDS1.Cancel;     raise;   end;Cancel doesn't fail if the dataset it's not in one of the edit modes (dsEdit, dsInsert). You can check the VCL source code for this.</content>
</entry>
<entry>
<title>try..except incorrectly used</title>
<author>
<name>Andrew Fionik</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=33219</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=33219</id>
<updated>2002-09-28T02:16:27-07:00</updated>
<published>2002-09-28T02:16:27-07:00</published>
<summary>try..except incorrectly used</summary>
<content>Let's see that code...      try        ClientDataSet1.Edit;        try          ClientDataSet1.Fields[0].Value :=            UpperCase(ClientDataSet1.Fields[0].Value);          ClientDataSet1.Post;        except          //record cannot be posted. Cancel;          ClientDataSet1.Cancel;        end;      except        //Record cannot be edit. Skip      end;Never write such exception handlers. This will lead to difficult detectable errors. Exception handling it is mechanism for program flow control, not mechanism for hiding errors.If you know how to handle specific exception and sure that you can safely recover from it then handle it and continue your work. If no then abort operation. Imagine if BeforePost handler raises EAccessViolation in such operation... when and where you see that exception? Certainly not in place where it happens. Then you get AV somewhere else (probably on the code that clear as virgin's tear) and spend much more time to determine what happens.It's questions of good programming style.</content>
</entry>
</feed>
