Saving/restoring strongly-typed DataTable to/from XML
Question posted by: timnels@gmail.com
(Guest)
on
January 31st, 2007 02:25 PM
I have a strongly-typed DataTable I need to save as XML and later
reload it.
I thought that all I had to do was:
menuDataTable.WriteXml(filename,XmlWriteMode.Write Schema);
And from another application do:
menuDataTable.ReadXml(filename);
But I keep getting... "DataTable 'ttMenuItemNS:ttMenuItem' does not
match to any DataTable in source."
Can anyone see what I am doing wrong here?
Thanks.
1
Answer Posted
Hi there
You have tp specify the schema when you read the xml document like:
menuDataTable.ReadXml(filename, XmlReadMode.ReadSchema);
Hope it helps
timnels:
Quote:
Originally Posted by
I have a strongly-typed DataTable I need to save as XML and later
reload it.
>
I thought that all I had to do was:
>
>
menuDataTable.WriteXml(filename,XmlWriteMode.Write Schema);
Quote:
Originally Posted by
>
And from another application do:
>
menuDataTable.ReadXml(filename);
>
But I keep getting... "DataTable 'ttMenuItemNS:ttMenuItem' does not
match to any DataTable in source."
>
Can anyone see what I am doing wrong here?
>
Thanks.
|
|
|
What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 197,004 network members.
Top Community Contributors
|