Iam writing a code to read XML file and display it in DataGridView, but it doesn't work, my code is as follows...
give me suggestions
DataTable an = new DataTable();
XmlDocument xmldoc=new XmlDocument();FileStream fsazm = new FileStream("D:\\data.xml", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
xmldoc.Load(fsazm);
XmlNodeList xmlnode = xmldoc.GetElementsByTagName("Student");
for (int i = 0; i < xmlnode.Count; i++)
{
XmlAttributeCollection xattrc = xmlnode[i].Attributes;
an.Rows[i][0] = xattrc[0].Value;
an.Rows[i][1] = xattrc[1].Value;
}

VulpesRank #55 · 29.2K reputationPosted May 1, 2014, 1:47 AM EDT
Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted May 1, 2014, 1:37 AM EDT
Anjan Kumar6 reputationPosted May 1, 2014, 2:16 AM EDT
VulpesRank #55 · 29.2K reputationPosted May 1, 2014, 2:33 AM EDT
http://msdn.microsoft.com/en-us/library/system.data.datatable.writexml(v=vs.110).aspx
Even if you only want to update the file, it's best just to recreate the whole thing from scratch which is what this method always does.
Anjan Kumar6 reputationPosted May 4, 2014, 2:07 AM EDT