Click here to Skip to main content
14,882,317 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
rading Xml
like this
DataTabel dt =new datatabel()
dt.readxml(filepath);
and the error i am getting is like this
DataTable does not support schema inference from Xml.
please help me out.
Posted

XmlReader xmlReader = XmlReader.Create(new StringReader(xmlString));
dataTable.ReadXml(xmlReader);

Regards,
Praveen Nelge
   
v2
check this similar post : How to convert a XMl File to DataTable using C# without saving XML file into local drive[^]

Try somelike this for your issue..
C#
DataTable dt = new DataTable("test");
            dt.Columns.Add("column", typeof(string));
            for (int i = 0; i < 7; i++)             
                dt.Rows.Add(i);
             
            // writing xml 
             
            dt.WriteXmlSchema("d://aa.xsd");
            dt.WriteXml("d://aa.xml");

            // reading xml
            DataTable dt1 = new DataTable();
            dt1.ReadXmlSchema("d://aa.xsd");
            dt1.ReadXml("d://aa.xml");
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900