Wednesday, November 24, 2010

Save data in Xml

protected void btnSubmit_Click(object sender, EventArgs e)
    {  
        DataSet ds = new DataSet();
        ds.ReadXml(Server.MapPath("XMLFile.xml"));
        DataRow dr = ds.Tables[0].NewRow();
        dr[0] = "By &nbsp; "+txtUserName.Text + "&nbsp; At " + DateTime.Now.ToString("F")+"<br><br>"+txtPassword.Text;
      
        ds.Tables[0].Rows.Add(dr);
      
        ds.AcceptChanges();

        ds.WriteXml(Server.MapPath("XMLFile.xml"));  
    }

1 comment:

  1. o good post its work like a charm....best of luck for your future..

    ReplyDelete