By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,694 Members | 1,310 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,694 IT Pros & Developers. It's quick & easy.

xml file to datatable

P: n/a
I have a XML file that is generated by the user. I need to take that XML and
either create a dataset and read the XML to populate some labels on my form.
I can I read the XML and put that into a datatable and populate the labels
on my form?

thx
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

The dataset has a readxml method that will put the data in a
datatable located inside a dataset.

http://msdn.microsoft.com/library/de...adXmlTopic.asp

Ken
-----------------------------
"Mike" <me@me.com> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
I have a XML file that is generated by the user. I need to take that XML and
either create a dataset and read the XML to populate some labels on my form.
I can I read the XML and put that into a datatable and populate the labels
on my form?

thx

Nov 21 '05 #2

P: n/a
Hi Mike,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to read data in an XML file to
a DataSet and bind some label controls to the DataSet. If there is any
misunderstanding, please feel free to let me know.

As far as I know, this depends on how the Xml file is generated. If it is
exported with DataSet.WriteXml, we can simply use DataSet.ReadXml to read
this to the DataSet. However, if it is an xml file which doesn't meet the
DataSet format, I think we have to make some changes to it or use an
XmlDocument to read data and add it to DataSet row by row.

When the DataSet is populated, we can use data binding to show the data in
the DataSet on label controls. Suppose we have a DataSet ds, a label
label1, the table name is Table1, we can use the following to show FistName
field on label1.

this.label1.DataBindings.Add("Text", ds, "Table1.FirstName");

For more information, please check:

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemdatadatasetclassreadxmltopic2.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 21 '05 #3

P: n/a
Mike,

In addition to Kevin, a XML dataset as file has this header
<?xml version="1.0" standalone="yes" ?>

And is mostly direct to recognize because it contains no attributes however
only elements.

Cor
Nov 21 '05 #4

P: n/a
Hi Mike,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.