Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 14th, 2008, 04:11 PM
Registered User
 
Join Date: Feb 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default reading XML with relationships

Hi,

I'm getting "A child row has multiple parents" error when I try to read an xml file created from a dataset that has two related tables. Both have a primary key, and are related using:
Code:
//Assign a relation   
DataRelation relation = myDS.Relations.Add(primarykey, foreignkey);
//Ask ADO.NET to generate nested XML nodes   
relation.Nested = true;
I am reading the xsd file first and then the xml file.

Any ideas?
 
Old February 14th, 2008, 04:21 PM
Registered User
 
Join Date: Feb 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I actually got it working using XmlReadMode.DiffGram.

But I have another question, I thought that because I related the tables in the dataset and then I binded them to datagrids, this would create a master/detail linked situation, i.e. when I click on a master record, the related detail record will get focus.

Do I have to code that functionality?
 
Old February 15th, 2008, 04:57 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

I think you need to use the BindingSource objects.

There are plenty of examples, just search for "BindingSource master detail", e.g.: http://msdn2.microsoft.com/en-us/library/y8c0cxey.aspx

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
reading a XML file connect2sandep XML 1 December 14th, 2006 04:50 AM
reading a XML file connect2sandep General .NET 0 December 13th, 2006 02:10 PM
Reading XML evidica C# 0 July 25th, 2006 10:33 AM
Reading XML datastream realgone_ Classic ASP XML 5 September 22nd, 2004 01:17 PM
Reading XML from ASP texasraven Classic ASP XML 2 February 26th, 2004 03:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.