I am trying to update the XML file using dataset, but it creates new node for the new values. below is the code.
private void on(object sender, EventArgs e)
{
try
{
DateTime currTime = DateTime.Now;
DateTime runDate, runTime;
XmlDataDocument xmldoc = new XmlDataDocument(dsTasks1);
foreach (DataRow dRow in dsTasks1.Tables["Job"].Rows)
{
runDate = Convert.ToDateTime(dRow["NextRunDate"]);
currTime.CompareTo(runDate);
runTime = Convert.ToDateTime(dRow["NextRunTime"]);
if ((currTime.ToLocalTime() >= runTime.ToLocalTime()) & (currTime >= runDate))
{
string exePath = dRow["Source"].ToString();
Launcher Launch = new Launcher(exePath);
new Thread(new ThreadStart(Launch.runApp)).Start();
dRow.BeginEdit();
dRow["NextRunDate"] = "3/12/2009";
dRow["NextRunTime"] = "11:00:00 AM";
dRow["Status"] = "Complete";
dRow.EndEdit();
dRow.AcceptChanges();
dsTasks1.AcceptChanges();
xmldoc.save(fs);
Vimal KandasamyPosted Mar 19, 2009, 2:06 AM
xml validation 1
xml validation 2
it may help you.
PrashanthPosted Mar 16, 2009, 9:46 AM
Thanks Vimal,
This article helped me understand the basics of XML. One more query how to use the schema file to do validation of XML file.
Regards,
Prashanth
Vimal KandasamyPosted Mar 13, 2009, 12:31 AM
hi
pls see my article...it may help you to update xml data.
PrashanthPosted Mar 12, 2009, 3:32 PM
Hi Steve,
I never used linq can you give any basic example like how to search and edit the xml file.
Regards
Prashanth
StefanPosted Mar 12, 2009, 3:22 PM
You're better off using linq to xml, rather than using a dataset.
It's easier, faster, and a lot easier to write the data the way you want.