主题:DATAGIRD读出的XML数据,如何更改字段名
现有这样一段XML文件,文件名为A.XML
<?xml version="1.0" encoding="utf-8" ?>
<Equipment>
<isEquipment>1</isEquipment>
<Config Name = "设备1">
<MAC>00-0A-EB-C2-9A-DF</MAC>
<Type>T888</Type>
</Config>
<Config Name = "设备2">
<MAC>01-00-C1-DB-2E-22</MAC>
<Type>T999</Type>
</Config>
</Equipment>
用以下代码读取
Dim ds As DataSet = New DataSet
ds.ReadXml(a.xml)
Dim tb As DataTable
Dim dv As DataView
tb = ds.Tables(1)
dv = New DataView(tb)
DataGrid1.SetDataBinding(dv, "")
xmlDD = New XmlDataDocument(ds)
Datagrid显示如下
MAC TYPE
00-0A-EB-C2-9A-DF T888
01-00-C1-DB-2E-22 T999
如何修改代码,让Datagrid显示如下数据
MAC [color=FF0000]类型[/color]
00-0A-EB-C2-9A-DF T888
01-00-C1-DB-2E-22 T999
<?xml version="1.0" encoding="utf-8" ?>
<Equipment>
<isEquipment>1</isEquipment>
<Config Name = "设备1">
<MAC>00-0A-EB-C2-9A-DF</MAC>
<Type>T888</Type>
</Config>
<Config Name = "设备2">
<MAC>01-00-C1-DB-2E-22</MAC>
<Type>T999</Type>
</Config>
</Equipment>
用以下代码读取
Dim ds As DataSet = New DataSet
ds.ReadXml(a.xml)
Dim tb As DataTable
Dim dv As DataView
tb = ds.Tables(1)
dv = New DataView(tb)
DataGrid1.SetDataBinding(dv, "")
xmlDD = New XmlDataDocument(ds)
Datagrid显示如下
MAC TYPE
00-0A-EB-C2-9A-DF T888
01-00-C1-DB-2E-22 T999
如何修改代码,让Datagrid显示如下数据
MAC [color=FF0000]类型[/color]
00-0A-EB-C2-9A-DF T888
01-00-C1-DB-2E-22 T999