接线从数据表中读取XML的ASN [英] Wirting asn reading xml from data table

查看:169
本文介绍了接线从数据表中读取XML的ASN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写下面的代码.

i''m writing the following code.

Dim dtTemp As DataTable = New DataTable("Temp")
dtTemp.Columns.Add("Sno")
dtTemp.Columns.Add("Name")
Dim dr As DataRow = dtTemp.NewRow()
dr(0) = 1
dr(1) = "Sairam"
dtTemp.Rows.Add(dr)
dr = dtTemp.NewRow()
dr(0) = 2
dr(1) = "temp"
dtTemp.Rows.Add(dr)
dtTemp.WriteXml("c:\temp.xml")

Dim dtXmlRd As DataTable = New DataTable("Temp")
dtXmlRd.ReadXml("c:\temp.xml")



在读取此xml filoe时,出现类似
的错误 "DataTable不支持从Xml进行模式推断."

请让我知道问题所在.



While Reading this xml filoe i''m getting an error like
"DataTable does not support schema inference from Xml."

Please let me know at''s the problem.

推荐答案

如果您首先调用ReadXmlSchema来引入描述以下内容的架构,则应该能够在DataTable实例上使用ReadXml数据.这就是您收到此错误的原因.
You should be able to use ReadXml on the DataTable instance if you first call ReadXmlSchema to pull in a schema describing the data. That is the reason you are getting this error.

Dim ds As New DataTable
ds.TableName = "TableName"
ds.ReadXmlSchema("e:\schema.xsd")
ds.ReadXml("e:\schema.xml")


这篇关于接线从数据表中读取XML的ASN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆