<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Comments for Nesting DataSets in ClientDataSets</title>
<link rel="alternate" type="text/plain" href="http://edn.embarcadero.com/article/29825" title="Nesting DataSets in ClientDataSets" />
<link rel="self" type="application/atom+xml" href="http://edn.embarcadero.com/article/29825/feed" title="Comments for Nesting DataSets in ClientDataSets" />
<id>http://edn.embarcadero.com/article/29825</id>
<updated>2009-11-07T22:15:08-08:00</updated>
<entry>
<title>Nested or not nested, you cannot INSERT into the detail table.</title>
<author>
<name>Cristian Georgescu</name>
<uri>http://threads.embarcadero.com/threads/threads.exe/userall?commentid=34844</uri>
</author>
<id>http://threads.embarcadero.com/threads/threads.exe/view?commentid=34844</id>
<updated>2003-06-25T06:41:50-07:00</updated>
<published>2003-06-25T06:41:50-07:00</published>
<summary>Nested or not nested, you cannot INSERT into the detail table.</summary>
<content>You can make a master/detail form by nested datasets (which is cooler) or regular way of linking. You will be able to SELECT or UPDATE data, but either way you cannot instruct the Midas engine to properly INSERT into the detail table (or query).Everybody have some sort of autogenerated IDs for tables (autoinc or other kind) and the provider cannot get the record ID (foreign key) of the master in order to use it when inserting into the detail. It starts by INSERTing the master record but it doesnt't retrieve from the table the autogenerated ID and it simply fills the foreign keys of the detail table with 0 or null. So you get the master record right and also some lines in the detail table, but with corrupted foreign keys. This happens even if you instruct the provider to pfAutoRefresh. I tried for days to set flags on the provider or to change the properties of the fields in the ClientDataSet but I'm getting the same behaviour.There are workarounds on the internet, but all of them by doing stuff which negates the cool functionality of Midas (now datasnap). Every workaround is by getting and setting the ID by hand, or by doing your own INSERT procedures.Some authors mention &quot;...AutoRefresh when it will be implemented&quot;... I choosed Delphi as development tool for our current project, we did the interface and the database, my guys made tons of data entry and editing forms and now, at the middle, we found that DataSnap cannot INSERT into tables, just SELECT and UPDATE. We started with a test database which is full with data, and nobody thought that if it can UPDATE it cannot INSERT.</content>
</entry>
<entry>
<title>Non-primary Master table key link to detail table</title>
<author>
<name>Wade Rupe</name>
<uri>http://threads.embarcadero.com/threads/threads.exe/userall?commentid=34672</uri>
</author>
<id>http://threads.embarcadero.com/threads/threads.exe/view?commentid=34672</id>
<updated>2003-05-22T08:20:54-07:00</updated>
<published>2003-05-22T08:20:54-07:00</published>
<summary>Non-primary Master table key link to detail table</summary>
<content>Is it possible to edit a nested dataset linked to a master table on a field not in the master table's primary key?I can view such data, but not insert a master record or point to a different detail record without key violations.As an example, I have taken your downloaded program &quot;19633_nested_datasets_from_master_detail_tables.zip&quot; and substituted the DBDEMOS table &quot;Items.db&quot; as the master and &quot;Parts.db&quot; as the detail.  Then I Linked the tables on the &quot;PartNo&quot; field.This seems to produce a nested table view of the relationship without being able add master records or point to a different detail without key violations.Is there a flag I need to set, or am I just waisting my time on this relationship as a nested dataset.I can create and edit this relationship with ClientDataSets by placing a second provider for the detail table, removing the MasterSource property of the detail table and then hooking a DataSource to the master ClientDataSet. Then link the detail ClientDataSet to that DataSource.  Is this the proper way?  Should I also filter the second table to load only the records I need for my detail set as well?  By the way, I was testing the Advantage Database server had difficulty with this type of relationship, which is why I was experimenting with nested tables.Thank you for you help.Wade</content>
</entry>
<entry>
<title>How to do it using two different data modules?</title>
<author>
<name>MARCELLO DIAS</name>
<uri>http://threads.embarcadero.com/threads/threads.exe/userall?commentid=34261</uri>
</author>
<id>http://threads.embarcadero.com/threads/threads.exe/view?commentid=34261</id>
<updated>2003-03-12T08:59:48-07:00</updated>
<published>2003-03-12T08:59:48-07:00</published>
<summary>How to do it using two different data modules?</summary>
<content>Hi,I tried to reproduce this by using two datamodules.One with SqlDataSets and providers and other with ClientDataSets and DataSources .But could not make it work.Regards,Marcello Dias</content>
</entry>
</feed>
