将Xml读取到Datatabel [英] Read Xml to Datatabel
本文介绍了将Xml读取到Datatabel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
i使用以下代码读取Xml文件
DataTable dt = new DataTable();
dt.ReadXml( @ C:\ Users \rahuls1 \Desktop \New folder( 5)\TestCases\TestSuite1\test.xml跨度>);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
但dt.ReadXml给出问题
DataTable不支持来自Xml的模式推断。
请帮帮我..
解决方案
使用 Dataset.ReadXML 而不是DataTable.ReadXML。
如果你想在调用ReadXML之前使用DataTable.ReadXML,你需要调用DataTable.ReadXmlSchema(< path to = xsd =file =>)
检查相同的问题..
如何使用C#将XMl文件转换为DataTable [ ^ 一>
hi
i am using following code to read Xml File
DataTable dt = new DataTable();
dt.ReadXml(@"C:\Users\rahuls1\Desktop\New folder (5)\TestCases\TestSuite1\test.xml");
DataSet ds = new DataSet();
ds.Tables.Add(dt);
but dt.ReadXml giving issue
DataTable does not support schema inference from Xml.
please help me out on this..
解决方案
Use Dataset.ReadXML instead ofDataTable.ReadXML.
If you want to use DataTable.ReadXML then before calling ReadXML you need to call DataTable.ReadXmlSchema(<path to="" xsd="" file="">)
Check the same question..
How to convert a XMl File to DataTable using C# [^]
这篇关于将Xml读取到Datatabel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文