I get the following error:
"Cannot change the DataSet name once the DataSet is mapped to a loaded XML document. "
This is my code
DataSet ds = new DataSet();
XmlDataDocument xdd = new XmlDataDocument(ds);
String fileName = Resources.FILE_NAME;
ds.ReadXmlSchema(fileName);
Does anyone have any idea what I could have done wrong?
Paris HiltonPosted Aug 7, 2008, 11:52 PM
Manish, thanks for the article. Unfortunately it didn't help me fix my problem. I still put it under my favourites because I am sure I will need it some day.
I noticed that my code works when I put it in my form code. However, I don't want to read an xml file in a form because reading an XML file has nothing to do with UI logic. Moreover, I need to use my dataset in more than one form.
So I created a class that has my DataSet as a static member. And than I get the above error when I run my code.
Can anyone explain why I get this error: "Cannot change the DataSet name once the DataSet is mapped to a loaded XML document" when I have a static DataSet and I don't get the error when my DataSet is not static?
Thanks so much.
Blocked AccountPosted Aug 7, 2008, 1:05 AM
Take the reference of this article.
http://microsoft.apress.com/asptodayarchive/72420/xml-support-in-adonet
Happy Coding!!