+2  A: 

It might be easier to just work with the higher-level DataSet, like this:

DataSet dataSet = new DataSet();
DataTable dataTable = new DataTable();

dataSet.Tables.Add(dataTable);
// Save to disk
dataSet.WriteXml(@"C:\MyDataset.xml");

// Read from disk
dataSet.ReadXml(@"C:\MyDataset.xml");
Robert Seder
Thats not working either..
Yash
Hahah! What does "not working" mean? I'll assume your machine blue-screened, then caught on fire. If that's not correct, could you describe what kind of error you saw or any other details?
Robert Seder
A: 

I fixed it, The Problem is, the tablename was assigned while saving but not while reading. So assign the table name globally, which will let it read and write without any problem.

so the code will be,

myDT_For_DGV.TableName = "CheckOutsAndIns";

if (openFileDialog1.ShowDialog() == DialogResult.OK) 
       {              
              myDT_For_DGV.ReadXml(@openFileDialog1.FileName);
            //MessageBox.Show(openFileDialog1.FileName);

        }

//TO WRITE TO XML
if (myDT_For_DGV.Rows.Count != 0)
        {
            saveFileDialog1.ShowDialog();
            saveFileDialog1.FileName = "checkOutFile.xml";
            myDT_For_DGV.WriteXml(saveFileDialog1.FileName, true);
        }
Yash