PC Review


Reply
Thread Tools Rate Thread

DataSet.ReadXML is ignoring UniqueConstraint on table... (ADO.NET

 
 
=?Utf-8?B?RFQ=?=
Guest
Posts: n/a
 
      11th Apr 2005
I have a DataTable with a UniqueConstraint defined for columns A and B:

ds.tables("myTab").constraints("myUC") has columns A and B in its Columns
collection

But ReadXML will load an XML document that has duplicate values for columns
A and B. After invoking ReadXML, the table contains:

ds.tables("myTab").rows(0)("A") value of 0 (integer)
ds.tables("myTab").rows(0)("B") value of "1" (string)

ds.tables("myTab").rows(1)("A") value of 0 (integer)
ds.tables("myTab").rows(1)("B") value of "1" (string)

I've tried both ReadSchema and IgnoreSchema values for XmlReadMode...both
allow the duplicate rows to be loaded.

Shouldn't ReadXML abide by the defined constraints?????

DT


 
Reply With Quote
 
 
 
 
=?Utf-8?B?RFQ=?=
Guest
Posts: n/a
 
      11th Apr 2005
Oooops!!!

DataSet.EnforceConstraints wasn't set to "True"

Don't know when/how it got set to False, since the default is True.
Explicitly setting it to True fixed the problem...

DT

"DT" wrote:

> I have a DataTable with a UniqueConstraint defined for columns A and B:
>
> ds.tables("myTab").constraints("myUC") has columns A and B in its Columns
> collection
>
> But ReadXML will load an XML document that has duplicate values for columns
> A and B. After invoking ReadXML, the table contains:
>
> ds.tables("myTab").rows(0)("A") value of 0 (integer)
> ds.tables("myTab").rows(0)("B") value of "1" (string)
>
> ds.tables("myTab").rows(1)("A") value of 0 (integer)
> ds.tables("myTab").rows(1)("B") value of "1" (string)
>
> I've tried both ReadSchema and IgnoreSchema values for XmlReadMode...both
> allow the duplicate rows to be loaded.
>
> Shouldn't ReadXML abide by the defined constraints?????
>
> DT
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ReadXml() method: standard DataSet vs. typed DataSet MikeOtown Microsoft ADO .NET 0 6th Dec 2007 05:15 PM
Multicolumn UniqueConstraint in typed dataset/datatable - How to implement? Marcus Microsoft ADO .NET 1 27th Jun 2006 06:49 PM
DataSet.ReadXml C Glenn Microsoft C# .NET 2 29th Nov 2005 01:04 PM
Re: does DataSet.ReadXml() clear current table information on DataSet CrunkByte Microsoft Dot NET Framework 0 21st May 2005 03:11 AM
Possible Bug in DataSet.ReadXml() Michelle Weber Microsoft ADO .NET 1 24th Dec 2003 06:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:01 AM.