XML file as DataSource in C# WinForm application

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have an application that will need 3 tables {Tasks, Tracker, Notes}, with only the Tasks table having 2 records when the application is first installed. The rest of the data in all the tables will be purely saved from user input in
the application. I would like to use XML file(s) as the means for storing all the data. I have created my form, which has a datagridview on it, and have already created a dataset in the designer to use as the Data Source for the DataGridView and
other application requirements. I am stuck as to where to go from here.
Ive added an XML file to my project called Resource.XML, but Im not really sure how to set up the file in order to have it work when I read it into my dataset. Below is my latest attempt:
<div style="background-color:white; color:black
<pre><span style="color:blue <?<span style="color:#a31515 xml <span style="color:red version<span style="color:blue =<span style="color:black "<span style="color:blue 1.0<span style="color:black " <span style="color:red encoding<span style="color:blue =<span style="color:black "<span style="color:blue utf-8<span style="color:black " <span style="color:blue ?>

<span style="color:blue <<span style="color:#a31515 TaskTracker<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 Tasks_Table<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 TaskID <span style="color:red value<span style="color:blue =<span style="color:black "<span style="color:blue 0<span style="color:black "<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 Task<span style="color:blue >Administrative<span style="color:blue </<span style="color:#a31515 Task<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 Report<span style="color:blue >1<span style="color:blue </<span style="color:#a31515 Report<span style="color:blue >

<span style="color:blue </<span style="color:#a31515 TaskID<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 TaskID <span style="color:red value<span style="color:blue =<span style="color:black "<span style="color:blue 1<span style="color:black "<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 Task<span style="color:blue >AFD (Away From Desk)<span style="color:blue </<span style="color:#a31515 Task<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 Report<span style="color:blue >1<span style="color:blue </<span style="color:#a31515 Report<span style="color:blue >

<span style="color:blue </<span style="color:#a31515 TaskID<span style="color:blue >

<span style="color:blue </<span style="color:#a31515 Tasks_Table<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 Tracker_Table<span style="color:blue >



<span style="color:blue </<span style="color:#a31515 Tracker_Table<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 Notes_Table<span style="color:blue >



<span style="color:blue </<span style="color:#a31515 Notes_Table<span style="color:blue >

<span style="color:blue </<span style="color:#a31515 TaskTracker<span style="color:blue >

[/code]

I have the following code in my forms opening and closing events respectively:
<div style="background-color:white; color:black
<pre><span style="color:green //Opening

TaskTrackerDS.ReadXml(Properties.Settings.Default.ResourceXMLPath);



<span style="color:green //Closing

TaskTrackerDS.WriteXml(Properties.Settings.Default.ResourceXMLPath);

[/code]


Any and all help is greatly appreciated!
<
PJ


View the full article
 
Back
Top