Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Needed Help on Converting from XmlNode to Dataset

Posted on 2004-09-12
2
Medium Priority
?
707 Views
Last Modified: 2008-02-01
Dear All,

I have a problem here, I'm using C# Webform calling a webservices. The webservices return me a XMLnode, using this XMLnode I want to convert it to dataset so I can bind to the datagrid, by extracting the <CustomerData></CustomerData> block from the xmlnode.

Below is the sample of xmlnode return from webservices.

<?xml version="1.0" encoding="utf-8"?>
<OutputParams>
  <CustomerData>
    <CustomerID>1</CustomerID>
    <CustomerName>TEST1</CustomerName>
    <Gender>M  </Gender>
    <DateOfBirth>19800101</DateOfBirth>
  </CustomerData>
  <CustomerData>
    <CustomerID>1</CustomerID>
    <CustomerName>TEST2</CustomerName>
    <Gender />
    <DateOfBirth>19000101</DateOfBirth>
  </CustomerData>
  <CustomerData>
    <CustomerID>3</CustomerID>
    <CustomerName>TEST3</CustomerName>
    <Gender />
    <DateOfBirth>19000101</DateOfBirth>
  </CustomerData>
  <ReturnCode>0</ReturnCode>
  <ErrorCode>0</ErrorCode>
  <ErrorDescription />
</OutputParams>

How can it be done? Please provide some examples on this.
Thanks in advance.


Cheers,
yymae
0
Comment
Question by:yymae
2 Comments
 
LVL 5

Accepted Solution

by:
tomasX2 earned 300 total points
ID: 12039583
XmlNode node = webService.GetNode();
DataSet ds = new DataSet();
XmlReader reader = new XmlNodeReader(node);
ds.ReadXml(reader);
dataGrid1.DataSource = ds.Tables["CustomerData"];
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month12 days, 14 hours left to enroll

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question