0

I'm experiencing a little problem here with my code:

DataSet _ds = new DataSet();

//convert xml to dataset
_ds.ReadXml(textBox1.Text);

try
{
//Create a relation between the Authors and the Titles tables.
       _ds.Relations.Add("Level", _ds.Tables["HEADER"].Columns["IDMAT"], _ds.Tables["ITEM"].Columns["IDNRK"]);
}
catch(DataException dt)
{
    util.logThis("ERROR while Adding Dataset Relations between tables / UI / ProcessClick event : " + dt.ToString(), "error");  
}

Exception System.ArgumentException was thrown in debuggee:
This constraint cannot be enabled as not all values have corresponding parent values.

By default there is no constraint set...so i was wandering what was going wrong?

Edited by diafol: fixed formatting

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by jelab89
0

Nope...here a sample of the file:

<?xml version="1.0"?>

<BOM>
  <HEADER>
   <IDMAT>1111</IDMAT>
  </HEADER>
  <ITEM>
   <IDNRK>1234</IDNRK>
   ...
  </ITEM>
  <ITEM>
   <IDNRK>1123</IDNRK>
   ...
  </ITEM>
  <ITEM>
   <IDNRK>1132</IDNRK>
   ...
  </ITEM>
</BOM>
<BOM>
  <HEADER>
   <IDMAT>1123</IDMAT>
  </HEADER>
  <ITEM>
   <IDNRK>1234</IDNRK>
   ...
  </ITEM>
  <ITEM>
   <IDNRK>1144</IDNRK>
   ...
  </ITEM>
  <ITEM>
   <IDNRK>1192</IDNRK>
   ...
  </ITEM>
</BOM>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.