TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
James
NA
1
0
DataSet XML
Nov 14 2007 11:11 AM
Hi,
I’m loading XML into a DataSet using the following…
// Create a new Customer DataSet.
CustomerDS = new DataSet();
// Get a handle to the Customer.xml file.
CustomerFileHandle = new FileStream(CUSTOMERXMLFILEPATH, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
// Read the Customer XML file into the DataSet.
CustomerDS.ReadXml(new XmlTextReader(CustomerFileHandle));
This loads the information into the DataSet and it can all be viewed on my Form.
After making changes to my data, I then want to update the XML file. To do this I’m using the following code…
XmlTextWriter CustXmlWriter = new XmlTextWriter(CustomerFileHandle, System.Text.Encoding.Unicode);
// Write to the file with the WriteXml method.
CustomerDS.WriteXml(CustXmlWriter, XmlWriteMode.IgnoreSchema);
CustXmlWriter.Close();
// Close the Customer XML File.
CustomerFileHandle.Close();
This is not producing valid XML. All data (the xml) is being repeated at the end of the file with a NULL character in between each character.
Any help on this would be much appreciated.
Thanks in advance.
Reply
Answers (
0
)
Managing Distributed Transactions with ADO.NET 2.0 using TransactionScope gives error message
dataset problem