473,406 Members | 2,259 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,406 software developers and data experts.

Help with datasets

Good morning all,

Heres what I have;
XML doc that had contacts setup inside it. Within each contact is a
lines group. Holds the phone lines for each contact.
I load up this xml into a dataset and what I end up with is;
Table 1 = My contacts, 2 of them for this test. Has all my columns
plus a new one the reader created, Contact_ID
Table 2 = A linkage table that the ReadXml cmd created when reading
in the data.
Has two fields: a] Contact_ID B] Phoneline_ID
Table 3 = Contacts PhoneLines, 3 rows for this test. Has all my
columns plus a new one the reader created, Phoneline_ID

Ok everything is fine here. Now what I want to do is somehow qurey this
dataset to return a dataview with a few fields from Table 1 and the
Line # field in Table 2.
How would I go about this? This is my first time playing with datasets. I
usually just use dataview objects that I populate thru SQL queries.

Thanks for the help
Deasun
--
Deasun
Home Site: www.tirnaog.com
Check out: The Code Vault in my forums section.
Nov 19 '05 #1
1 1053
Do you really need to return a DataView. You could use the DataTable.Select
method along with a filter that would give you back the appropriate rows.

If you wanted to get a bit more complicated, you could build up a new
dataset with a couple of tables by hand, add the appropriate columns to each,
add a relation between the two, get the rows from the originial dataset you
want via DataTable.Select(string filter) and populate the new dataset you've
created with the data.

While this might seem a little overblown, there currently isn't a way to
have a DataView sit on top of multile DataTables so this sort of becomes a
necessary evil.

Also, by having the relation in place, from the contact parent table you'll
be able to retrieve the children records from the second table via the
relations GetChildRows method.

"Deasun" wrote:
Good morning all,

Heres what I have;
XML doc that had contacts setup inside it. Within each contact is a
lines group. Holds the phone lines for each contact.
I load up this xml into a dataset and what I end up with is;
Table 1 = My contacts, 2 of them for this test. Has all my columns
plus a new one the reader created, Contact_ID
Table 2 = A linkage table that the ReadXml cmd created when reading
in the data.
Has two fields: a] Contact_ID B] Phoneline_ID
Table 3 = Contacts PhoneLines, 3 rows for this test. Has all my
columns plus a new one the reader created, Phoneline_ID

Ok everything is fine here. Now what I want to do is somehow qurey this
dataset to return a dataview with a few fields from Table 1 and the
Line # field in Table 2.
How would I go about this? This is my first time playing with datasets. I
usually just use dataview objects that I populate thru SQL queries.

Thanks for the help
Deasun
--
Deasun
Home Site: www.tirnaog.com
Check out: The Code Vault in my forums section.

Nov 19 '05 #2

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

Similar topics

0
by: harish | last post by:
Friends. I have three Datasets to be populated to one Excel Workbook. but i need to populate each datasets in to one worksheet. So if i export the datasets to one excel file, sheet1 should have...
4
by: Alpha | last post by:
I have a small Window application and through out the different forms I create a different dataset. At the begining I used the Tools to drag and drop the SqlDataAdapter, connection and dataset...
2
by: Sandy | last post by:
Hello - I am used to retrieving data with stored procedures. DataSets have me baffled inasmuch as it exposes Sql statements directly in the code, however, I think I need to be working with...
6
by: lennon1 | last post by:
Hi, I have already started learning .NET and I have a question. If I want to do anything - Display Data, Navigate, Update - with database (SQL Server) in Visual Studio 2005, do I have to use all...
16
by: Luqman | last post by:
Is it recommended to use datasets in ASP.Net 2.0 / VS.Net 2005 ? Best Regards, Luqman
4
by: Ronald S. Cook | last post by:
I've always used untyped datasets. In a Microsoft course, it walks through creating typed datasets and harps on the benefits. It has you drag all these things around ..wizard, wizard, wizard......
5
by: Warex | last post by:
I am using the example from the microscuzz site on making a key but It keeps giving me an error: With DataSets.Tables("Numbers") .PrimaryKey = New DataColumn() {.Columns("Number")} End With ...
0
by: S.Tedeschi | last post by:
Hi all; as posted some days ago, I'm converting an on-line app; I used to heavily rely on strongly-typed DataSets directly dropped onto pages, and so viewed by code(-behind) as well. In the next...
12
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
9
by: gardnern | last post by:
We have X number of data sets, of Y length each. For example... Small, Medium, Large and Red, Green, Blue, Yellow We need to generate a list of all possibilities Small Red
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.