Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从xml模式加载数据表_C#_Datatable_Xsd - Fatal编程技术网

C# 从xml模式加载数据表

C# 从xml模式加载数据表,c#,datatable,xsd,C#,Datatable,Xsd,我正在尝试从xml模式加载数据表。我可以在datatable上看到列名,但看不到数据。这是我的密码: StringReader sr = new StringReader(dsSorgu.Tables[0].Rows[i]["sorguSonucu"].ToString()); s.M_Sonucu = new DataTable(); s.M_Sonucu.ReadXmlSchema(sr); srgKullaniciSorgulari.Add(s); sr包含xml

我正在尝试从xml模式加载数据表。我可以在datatable上看到列名,但看不到数据。这是我的密码:

   StringReader sr = new StringReader(dsSorgu.Tables[0].Rows[i]["sorguSonucu"].ToString());
   s.M_Sonucu = new DataTable();
   s.M_Sonucu.ReadXmlSchema(sr);
   srgKullaniciSorgulari.Add(s);
sr包含xml模式

“XML模式描述XML文档的结构。”

如果它是一个模式,那么它不应该包含数据。您需要另一个包含数据的文件,如有必要,可以使用模式来验证该文件


请参阅:什么是XML模式?

XML模式不包含任何数据,只包含表、关系和约束定义。您需要调用ReadXml方法来加载实际数据(将由您的模式验证)