473,385 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Navigate a DataSet/DataTable

Hello,

I am having trouble understanding how to navigate a DataSet table... - maybe
someone can steer me in the right direction?

Say you've read an XML document into a DataSet ("myDataSet") and then filled
a DataTable by doing: myDataSet.Tables["situation"];
and the XML looks this way:
....
<situation>
<objectID>123</objectId>
<validityPeriod>
<start>2004-10-16T06:00:00+02:00</start>
<end>2004-10-18T15:00:00+02:00</end>
</validityPeriod>
....
</situation>
....

Now, the DataTable is filled nicely and I can access the "objectId" value
easily, but I just don't understand how I can go from "situation" to
"validityPeriod" and then on to "start" and "end".

I THINK I managed to get to the "start" and "end" values directly, by using
"GetChildRows" somehow - but the way I did that, I couldn't make sure that
the "start" and "end" I found were actually children of "validityPeriod",
which I have to be sure of.

Could anyone help me navigate this DataTable?
Thanks in advance!

Sincerely,
Carl Lindmark
Nov 17 '05 #1
2 5039
Hello Carl,

The GetChildRows is the way to go, and as far as I remember the DataSet XML
reading logic *will* infer a child validityPeriod table from the XML
structure you have.
You can simply check that by setting a breakpoint where you retrieve child
rows, adding a variable containing a reference to the child row to the Watch
window and drilling down it's Table property.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Carl Lindmark" <RepliesInNewsGroupOnly@Thanks> wrote in message
news:es**************@TK2MSFTNGP12.phx.gbl...
Hello,

I am having trouble understanding how to navigate a DataSet table... -
maybe
someone can steer me in the right direction?

Say you've read an XML document into a DataSet ("myDataSet") and then
filled
a DataTable by doing: myDataSet.Tables["situation"];
and the XML looks this way:
...
<situation>
<objectID>123</objectId>
<validityPeriod>
<start>2004-10-16T06:00:00+02:00</start>
<end>2004-10-18T15:00:00+02:00</end>
</validityPeriod>
...
</situation>
...

Now, the DataTable is filled nicely and I can access the "objectId" value
easily, but I just don't understand how I can go from "situation" to
"validityPeriod" and then on to "start" and "end".

I THINK I managed to get to the "start" and "end" values directly, by
using
"GetChildRows" somehow - but the way I did that, I couldn't make sure that
the "start" and "end" I found were actually children of "validityPeriod",
which I have to be sure of.

Could anyone help me navigate this DataTable?
Thanks in advance!

Sincerely,
Carl Lindmark


Nov 17 '05 #2
Hi Dmytro,

Thank you very much for your pointers!
I had not realized that the "validityPeriod" XML tag would be a TABLE - I
thought it would just be a sub ROW... But now I'm beginning to understand
how these datasets and datatables work. Thank you very much!

/Carl

"Dmytro Lapshyn [MVP]" <x-****@no-spam-please.hotpop.com> skrev i
meddelandet news:uu**************@TK2MSFTNGP10.phx.gbl...
Hello Carl,

The GetChildRows is the way to go, and as far as I remember the DataSet XML reading logic *will* infer a child validityPeriod table from the XML
structure you have.
You can simply check that by setting a breakpoint where you retrieve child
rows, adding a variable containing a reference to the child row to the Watch window and drilling down it's Table property.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Carl Lindmark" <RepliesInNewsGroupOnly@Thanks> wrote in message
news:es**************@TK2MSFTNGP12.phx.gbl...
Hello,

I am having trouble understanding how to navigate a DataSet table... -
maybe
someone can steer me in the right direction?

Say you've read an XML document into a DataSet ("myDataSet") and then
filled
a DataTable by doing: myDataSet.Tables["situation"];
and the XML looks this way:
...
<situation>
<objectID>123</objectId>
<validityPeriod>
<start>2004-10-16T06:00:00+02:00</start>
<end>2004-10-18T15:00:00+02:00</end>
</validityPeriod>
...
</situation>
...

Now, the DataTable is filled nicely and I can access the "objectId" value easily, but I just don't understand how I can go from "situation" to
"validityPeriod" and then on to "start" and "end".

I THINK I managed to get to the "start" and "end" values directly, by
using
"GetChildRows" somehow - but the way I did that, I couldn't make sure that the "start" and "end" I found were actually children of "validityPeriod", which I have to be sure of.

Could anyone help me navigate this DataTable?
Thanks in advance!

Sincerely,
Carl Lindmark

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bill C. | last post by:
Hi, I've got a simple console app that just reads an XML file into a DataSet then prints out a description of each table in the DataSet, including column names and row values for each column. ...
2
by: mjpiedade | last post by:
I just started with C#. How do I navigate on a dataset by changing the value of a textbox or other simple bound controls? Imagine that I have the customer name on a textbox and have a datagrid...
15
by: JIM.H. | last post by:
Hello, Can I send a dataset as a parameter into stored procedure and import data to a table in the stored procedure? Thanks, Jim.
15
by: Bob | last post by:
Hello: I'm building a simple windows database application that has two tables with One to One relationships on MS Access tables. I know what your thinking. Why not just use one table? ...
10
by: dauphian | last post by:
Hello, I am new to .net and am trying to build a report application that queries 4 different tables based on a id, and I need to return them in the same table for easy viewing. Basically, I...
4
by: Peter Newman | last post by:
i have a dataset and want to step thrpugh each row each time a user clicks a button,
3
by: Tom | last post by:
I have a dataTable being returned from my datalayet, I need to convert it to a dataSet so I can do some data manipulation to it prior to populating my datagrid. How can I convert the datatable to a...
2
by: senthilnova | last post by:
hi i have a form with First,Next,Prev,Buttons. i had populated a datatable with datas .Now i need to navigate through the records , can any body help me how to achieve this. ...
3
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.