AUTHOR
    share
  • Canada
  • Member since Feb 18 2009

Bio

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

Recent Posts     Most popular

    No contribution found in last 2 years