Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

help in creating a xml

I have did a program such that , i will have two text box name and age in my form..and a button..so that when the values entered r in the text box..a xml file is created with those data...
and my coding is as follows.

Inside the burtton click, th e coding is as follows

//create a dataset
DataSet dataSet = new DataSet();
//read the schema
dataSet.ReadXmlSchema("d:\\Menu.xsd");
//create a new row
DataRow newrow;
newrow = dataSet.Tables[0].NewRow();
//enter the values
newrow[0] = Convert.ToInt32(txtName.Text);
newrow[1] = Convert.ToInt32(txtAge.Text);
//add the row to the dataset
dataSet.Tables[0].Rows.Add(newrow);
//write the data to a xml file
dataSet.WriteXml("D:\\myData.xml", XmlWriteMode.WriteSchema);
MessageBox.Show("saved");

Now i have one doubt..
ie, the program which i did ..now ..in the form...when i am giving data as
for
name: john
age:22...
now myData.xml wil be saved with those data ... Now if i am clearing those vaues in th textbox and adding some other data... that should be added without deleting the previous data... and also if i am entering again john..it should show that already it exists...
please say how to do this..
[1358 byte] By [dhol] at [2007-11-11 7:36:25]