473,320 Members | 1,993 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

New XMLDataDocument(DataSet) - exception when relations.nested = true


Why does this fail?
Dim relResources As New Data.DataRelation("Application_Resources",
..Tables("User_Applications").Columns("Application _id"),
..Tables("Resource_Rights").Columns("Application_i d"), False)
mUserData.Relations.Add(relResources)
relResources.Nested = True
Dim UserDataXML As System.Xml.XmlDataDocument = New
System.Xml.XmlDataDocument(mUserData)

The last line fails with 'Object reference not set to an instance of an
Object' in onnestedparentchange.

Why can't I do this? This is almost exactly the code I find online - however
I have yet to see one example actually have all the complete code. I have,
however, found one post from someone who had this same problem but no
responses.

To answer the obvious questions -
Yes, I've googled the heck out of this problem to no avail.
Yes, the data is valid for relationships. Applying constraints is
successful and doesn't change anything.
The dataset contains four tables.
There's only one relationship between two of them (as listed above) and
no other relationships.
Any help is -greatly- appreciated.

Thanks!

Jim
Nov 12 '05 #1
2 3879
I have not had trouble with a single nested table, however when I add a
second level of nesting I get the same System.NullReferenceException
exception. Here is my stack. Notice that the childCol is null - perhaps the
problem.
system.data.dll!System.Xml.XmlDataDocument.OnNeste dParentChange(System.Data.DataRow
child = {System.Data.DataRow}, System.Xml.XmlBoundElement childElement =
{System.Xml.XmlBoundElement}, System.Data.DataColumn childCol = <undefined
value>) + 0xcc bytes
system.data.dll!System.Xml.XmlDataDocument.OnAddRo w(System.Data.DataRow
row = {System.Data.DataRow}) + 0x102 bytes

system.data.dll!System.Xml.XmlDataDocument.LoadTre eFromDataSet(System.Data.DataSet ds = {System.Data.DataSet}) + 0x14e bytes
system.data.dll!System.Xml.XmlDataDocument.Bind(bo ol fLoadFromDataSet =
true) + 0x6d bytes
system.data.dll!System.Xml.XmlDataDocument.Init(Sy stem.Data.DataSet ds =
{System.Data.DataSet}) + 0xa8 bytes

system.data.dll!System.Xml.XmlDataDocument.XmlData Document(System.Data.DataSet dataset = {System.Data.DataSet}) + 0x50 bytes
.... the rest is my user code ...

Microsoft: What are the conditions under which this exception will be thrown?

Thanks,
-Brad Schuler
MSDN Universal Subscriber

"James Ankrom" wrote:

Why does this fail?
Dim relResources As New Data.DataRelation("Application_Resources",
..Tables("User_Applications").Columns("Application _id"),
..Tables("Resource_Rights").Columns("Application_i d"), False)
mUserData.Relations.Add(relResources)
relResources.Nested = True
Dim UserDataXML As System.Xml.XmlDataDocument = New
System.Xml.XmlDataDocument(mUserData)

The last line fails with 'Object reference not set to an instance of an
Object' in onnestedparentchange.

Why can't I do this? This is almost exactly the code I find online - however
I have yet to see one example actually have all the complete code. I have,
however, found one post from someone who had this same problem but no
responses.

To answer the obvious questions -
Yes, I've googled the heck out of this problem to no avail.
Yes, the data is valid for relationships. Applying constraints is
successful and doesn't change anything.
The dataset contains four tables.
There's only one relationship between two of them (as listed above) and
no other relationships.
Any help is -greatly- appreciated.

Thanks!

Jim

Nov 12 '05 #2
I found that the order in which the relationships are created is significant
to this problem! You should always create the relationships from top-down.

That is...if you are using nested relationships so the XML appears like this:

<Grandparent>
...
<Parent>
...
<Child>
...
</Child>
</Parent>
</Grandparent>

Then you should create the relationships in this order:

Grandparent - Parent
Parent - Child

"Brad_Schuler" wrote:
I have not had trouble with a single nested table, however when I add a
second level of nesting I get the same System.NullReferenceException
exception.

.....

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: kevin_Eld | last post by:
I have the following xml: <message> <envelope> <body key="" value="" /> </envelope> </message> I have associated an xsd to this xml in order to use the XmlDataDocument and give me the
1
by: Peter Feakins | last post by:
We're building some web services that are primarily being consumed by a .net application. We're returning datasets for that purpose. We're also have to provide access to these services to classic...
1
by: Derrick | last post by:
Thanks to many on this newsgroup, I now have a prototype Windows Forms C# app that reads xml documents into DataSets via XmlDataDocument, and does *stuff* with it. I basically have about 25 megs...
3
by: Derrick | last post by:
I am reading in xml files that equate to sql tables, via XmlDataDocument, and then operating on the DataSet. With the most simple app that just loads the xml doc, I see the memory footprint of the...
2
by: deko | last post by:
I create an XmlDataDocument Dataset when the main form of my WinForms app opens. The user will make changes to the Dataset, and then those changes should be saved to the XML file when the code...
0
by: Vinit | last post by:
hi if i try to synchronize a dataset with xml using XmlDataDocument dataDoc = new XmlDataDocument(dataSetName) it throws an exception saying Object reference not set to an instance of the...
1
by: phl | last post by:
Hi, I am trying to design a good way of dealing with my XML data. There's mostly like going to be less than 200 records. I would like to be able to read XML data so I display it in my front...
1
by: JD | last post by:
I have a DataGridView with a DataSet as DataSource. The user can update the contents of the DataGridView, and then click on a Save button to save the data to an XML file. When they click on...
2
by: ERingmae | last post by:
Hi, The environment is .NET 2.0, the language is C# and the problem is reading XSD file with xs:redefine section correctly to a XMLDataDocument.DataSet. What I am trying to do: I am trying...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.