Hi,
I have a problem reading xml into a dataset using the XmlDataDocument.
In a test project, I created the following xml file:
<?xml version="1.0" standalone="yes"?>
<Customer>
<OrderDetails>
<OrderID>5</OrderID>
<ProductID>6</ProductID>
</OrderDetails>
</Customer>
And I use the following code to read it:
TestDataSet ds = new TestDataSet(); // TestDataSet is a typed dataset
with 1 table "OrderDetails", with 1 column "OrderID"
System.Xml.XmlDataDocument doc = new System.Xml.XmlDataDocument(ds);
doc.Load("Test.xml");
foreach (TestDataSet.OrderDetailsRow row in ds.OrderDetails)
{
Console.WriteLine(row.OrderID);
}
ds.OrderDetails always has a rowcount of 0.
It works when I change the xml to this:
<?xml version="1.0" standalone="yes"?>
<DataSet xmlns="http://tempuri.org/TestDataSet.xsd">
<Customer>
<OrderDetails>
<OrderID>5</OrderID>
<ProductID>6</ProductID>
</OrderDetails>
</Customer>
</DataSet>
I used this article to create my test project:
http://msdn2.microsoft.com/en-us/lib...13(VS.80).aspx and I
see no "<DataSet xmlns="http://tempuri.org/TestDataSet.xsd">" line in
the example xml there