title: Dataset XML Reading Failed to enable constraint in c#
body: <p>I have a dataset which was created using integrated VisualStudio designer with proper tables, fields and relations. </p>
  
  <p><a href="https://i.stack.imgur.com/K7Dwe.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K7Dwe.jpg" alt="enter image description here"></a></p>
  
  <p>However I want to query for the events that are within a specific date, When I try to read the xml file</p>
  
  <pre><code>this.localDB1.ReadXml($"C:\\Users\\Mike\\source\\repos\\evnt\\evnt\\bin\\Debug\\user.xml");
  </code></pre>
  
  <p>when I use that code to read the xml file to the dataset I get the following exception</p>
  
  <pre><code>System.Data.ConstraintException
    HResult=0x8013192A
    Message=Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
    Source=System.Data
    StackTrace:
     at System.Data.DataSet.EnableConstraints()
     at System.Data.DataSet.set_EnforceConstraints(Boolean value)
     at System.Data.XmlDataLoader.LoadData(XmlReader reader)
     at System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving)
     at System.Data.DataSet.ReadXml(String fileName)
     at EventManageWPF.View.AddEvent.&lt;btn_save_Click&gt;d__15.MoveNext() in    C:\Users\mike\source\repos\evnt\evnt\ViewEvent.cs:line 158
  </code></pre>
  
  <p>This is my XML file</p>
  
  <pre><code>&lt;?xml version="1.0" standalone="true"?&gt;
  &lt;LocalDB xmlns="http://tempuri.org/LocalDB.xsd"&gt;
  &lt;UserEvents&gt;
  &lt;eventid&gt;event1&lt;/eventid&gt;
  &lt;/UserEvents&gt;
  &lt;EventDates&gt;
  &lt;Id&gt;-1&lt;/Id&gt;
  &lt;startDate&gt;2019-11-25T12:59:15.3809179+05:30&lt;/startDate&gt;
  &lt;endDate&gt;2019-11-25T13:59:15.1449851+05:30&lt;/endDate&gt;
  &lt;UserEvents_eventid&gt;event1&lt;/UserEvents_eventid&gt;
  &lt;/EventDates&gt;
  &lt;/LocalDB&gt;
  </code></pre>
  
  <p>I'm new to c# so I'm unable to find a solution for this</p>