DataTable Does Not Support Schema Inference From Xml Error

DataTable Does Not Support Schema Inference From Xml

DataTable does not support schema inference from Xml
If you are trying to read XML File Data Into DataTable and getting schema inference error then you may have written the code as mentioned below.

"DataTable does not support schema inference from Xml"


C# CODE
protected void btnReadXmlFile_Click(object sender, EventArgs e)
    {
        string xmlFilePath = Server.MapPath("~/Employees.xml");
        DataTable dtXml = new DataTable("Employee");
        
        dtXml.ReadXml(xmlFilePath);
        GridView1.DataSource = dtXml;
        GridView1.DataBind();
    }

To fix this error, you need to create columns in datatable matching with your XML file elements to Read XML File Into DataTable successfully by following code mentioned in the link.

If you like this post than join us or share

0 comments:

Find More Articles