从XML加载DataGridView中的数据 [英] Load data in DataGridView from XML

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

问题描述

亲爱的所有人,我使用下面的代码将数据从XML加载到DataGridView。但只显示了3列。需要做些什么,以XML格式加载整个数据?



Dear All, I am using below code to load data from an XML to DataGridView. But Only 3 columns is showing. What need to do differently, to load entire data in XML??

Dim dataSet = New DataSet

        dataSet.ReadXml("C:\Users\Shafiul Alam\Desktop\TEST FILE\TEST FILE\Testing XML Files_V19.Sep\PXSH-QQUBWC_WMB_GMC_11.xml")
        DataGridView1.DataSource = dataSet.Tables(0)





使用如链接中的XML文件: https://drive.google.com/file/d/0B5BU24evXI3AVy1SOEVvT2FWcE0 / view?usp = sharing [ ^ ]



请帮助..



Using XML File as in the link: https://drive.google.com/file/d/0B5BU24evXI3AVy1SOEVvT2FWcE0/view?usp=sharing[^]

Please help..

推荐答案

//在这里试试
http://www.aspdotnet-suresh.com/2012/ 05 / aspnet-read-xml-node-values-and-bind.html [ ^ ]
//Try here
http://www.aspdotnet-suresh.com/2012/05/aspnet-read-xml-node-values-and-bind.html[^]


//Yes you can pls see the following c# code I am not that much aware of VB
//use dataSet and assign load xml file to dataset from there you can bind to your gv as //you did in your QUS that can work..

/// <summary>
/// Bind xml data to datalist
/// </summary>
private void BindDatalist()
{
XmlTextReader xmlreader = new XmlTextReader(Server.MapPath("Sample.xml"));
DataSet ds = new DataSet();
ds.ReadXml(xmlreader);
xmlreader.Close();
if (ds.Tables.Count != 0)
{
dlComments.DataSource = ds;
dlComments.DataBind();
}
else
{
dlComments.DataSource = null;
dlComments.DataBind();
}
} 







http://www.aspdotnet-suresh.com/2010/12/如何插入数据到xml-and-how-to.html [ ^ ]


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

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