Retrive data from xml file into a datagridview in c#.net -


i importing data xml file datagridview in c# problem 1 row shown in data grid view i.e overwritten . code follows

dataset ds = new dataset(); datatable dt = new datatable();  (int = 0; <= 3; i++) {     ds.readxml(@"c:\users\dell\downloads\chillerreport.xml");     datagridview1.datasource= ds.tables[i].defaultview; } 

my xml code follows

<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="file:///c:\techview\xsl\techview ashraereport.xsl"?>  <tranechillerservicereport label="ashrae chiller report">  <date label="date">wednesday, april 17, 2013 4:15:48 pm ist</date>   <technician label="technician">sss</technician>   <job_name label="job name">01 17 04 13</job_name>  <chiller_name label="chiller name">trane</chiller_name>  <reference_number label="ref number">01</reference_number> <location label="location">ppmf</location> </chiller_setpoints> </tranechillerservicereport> 

please help

enter image description heretry in code behind

            xmlreader xmlfile = xmlreader.create("yourfullxmlfilepath",new xmlreadersettings());             dataset dataset = new dataset();              dataset.readxml(xmlfile);              datagridview1.datasource = dataset.tables["empdetails"];             datagridview1.databind(); 

here xml file demo

<?xml version="1.0" encoding="utf-8" ?> <employee>   <empdetails id="1" name="sam"/>   <empdetails id="2" name="robin"/>   <empdetails id="3" name="victor"/> </employee> 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -