A
Andy Sjostrom
Hi!
I have a DataSet (dsTracking) which contains a row is updated with DataSet
XML and inline Schema.
So, in a DataRow I have XML data and schema that can be used to create a
DataSet.
The XML data and schema was created using DataSet.WriteXml with the
appropriate XmlWriteMode:
ds.WriteXml(xtw, XmlWriteMode.WriteSchema);
How can I create a DataSet based on data in a DataRow?
Using DataSet.ReadXml () I can specify XmlReadMode.ReadSchema as the second
argument. But what about the first?
I have tried this:
DataSet ds = new DataSet();
MemoryStream ms = new MemoryStream();
StreamWriter sw = new StreamWriter(ms);
sw.Write(dsTracking.Tables["TrackingDataTable"].Rows[0]["DataSetXML"]);
ms.Seek(0, SeekOrigin.Begin);
StreamReader sr = new StreamReader(ms);
ds.ReadXml(sr.ReadToEnd(), XmlReadMode.ReadSchema);
The above code throws an exception at the ds.ReadXml... The exception is:
"Additional information: Invalid URI: The URI scheme is not valid."
Thanks,
Andy Sjostrom
MS MVP - Mobile Devices
I have a DataSet (dsTracking) which contains a row is updated with DataSet
XML and inline Schema.
So, in a DataRow I have XML data and schema that can be used to create a
DataSet.
The XML data and schema was created using DataSet.WriteXml with the
appropriate XmlWriteMode:
ds.WriteXml(xtw, XmlWriteMode.WriteSchema);
How can I create a DataSet based on data in a DataRow?
Using DataSet.ReadXml () I can specify XmlReadMode.ReadSchema as the second
argument. But what about the first?
I have tried this:
DataSet ds = new DataSet();
MemoryStream ms = new MemoryStream();
StreamWriter sw = new StreamWriter(ms);
sw.Write(dsTracking.Tables["TrackingDataTable"].Rows[0]["DataSetXML"]);
ms.Seek(0, SeekOrigin.Begin);
StreamReader sr = new StreamReader(ms);
ds.ReadXml(sr.ReadToEnd(), XmlReadMode.ReadSchema);
The above code throws an exception at the ds.ReadXml... The exception is:
"Additional information: Invalid URI: The URI scheme is not valid."
Thanks,
Andy Sjostrom
MS MVP - Mobile Devices