Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Bind xml nodes to a dataset

Author  Topic 

zhshqzyc
Posting Yak Master

240 Posts

Posted - 2008-11-01 : 22:16:44
Hello,
We know it can be create a report via xml file.
I have an XML file Data.xml, which looks like this:

 <?xml version="1.0" encoding="utf-8" ?> 
<Company>
<Employees>
<Employee Name="Mahesh Chand" Age="30" Phone="6101233333" />
<Employee Name="Rose Garner" Age="56" Phone="2133428778" />
<Employee Name="Amger Jap" Age="22" Phone="9092349800" />
<Employee Name="Mike Gold" Age="35" Phone="9908088823" />
<Employee Name="Renee Flower" Age="19" Phone="4848901003" />
</Employees>
</Company>


The codes look like below.
Dim ds As DataSet = New DataSet()
ds.ReadXml("Data.xml")
EmployeeBindingSource.DataSource = ds
Me.reportViewer1.RefreshReport()


Now my question is if I only want bind some extracted nodes from a file.
How can I bind the xml to the dataset? Because we are unable to use a ReadXml("Data.xml") upon it.

For instance,comparing to the entire file.
How to bind the following with a dataset?

<Employees>
<Employee Name="Mahesh Chand" Age="30" Phone="6101233333" />
<Employee Name="Rose Garner" Age="56" Phone="2133428778" />
<Employee Name="Amger Jap" Age="22" Phone="9092349800" />
<Employee Name="Mike Gold" Age="35" Phone="9908088823" />
<Employee Name="Renee Flower" Age="19" Phone="4848901003" />
</Employees>






afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-11-02 : 05:06:35
If am understanding you correctl, I would advice you to use the object datasource. Does a job good for you mapping an XML file to a gridview control
Go to Top of Page

zhshqzyc
Posting Yak Master

240 Posts

Posted - 2008-11-02 : 09:34:34
quote:
Originally posted by afrika

Does a job good for you mapping an XML file to a gridview control


No, I don't need to map an XML file.
Can you please tell me how to use an object datasource for this case?

Thanks
Go to Top of Page
   

- Advertisement -