Prashanth

Prashanth

  • NA
  • 5
  • 3.2k

XML DataDocument and Dataset

Mar 12 2009 2:27 PM

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);


Answers (5)