c# - How to put multiple xml data in datagridview -
lets have multiple xml data this:
<entry> <url><![cdata[http://triada.kh.ua/made/?email=abuse@example.com]]></url> <phish_id>3779980</phish_id> <phish_detail_url>http://www.phishtank.com/phish_detail.php?phish_id=3779980</phish_detail_url> <details> <detail> <ip_address>93.190.41.34</ip_address> <cidr_block>93.190.40.0/21</cidr_block> <announcing_network>6849</announcing_network> <rir>ripencc</rir> <detail_time>2016-01-24t01:00:58+00:00</detail_time> </detail> </details> <submission> <submission_time>2016-01-22t22:42:56+00:00</submission_time> </submission> <verification> <verified>yes</verified> <verification_time>2016-03-28t14:15:01+00:00</verification_time> </verification> <status> <online>yes</online> </status> <target>internal revenue service</target> </entry>
lets have multiple of kind of xml data how show values in datagridview without overwriting them? have tried following code:
foreach (xelement result in query) { string display = result.tostring(); xmlreader xmlfile; xmlfile = xmlreader.create(new stringreader( display)); dataset ds = new dataset(); ds.readxml(xmlfile); datagridview1.datasource = ds.tables[0]; }
but table gets overwritten , displays last xmldata.please help.thanks in advance
a datagrid can't have multiple datasources. if have multiple data pieces, need merge , bind grid. in example can use dataset.merge method.
however... not sure how data, seems don't need read each xml element , create dataset out of it. should read elements @ once , bind grid.
Comments
Post a Comment