473,395 Members | 1,412 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,395 software developers and data experts.

Converion of DataSet to a flat DataTable

Hi,
What is the best way to convert DataSet containing parent child relations
into a single DataTable (Flatten)

For eg:-
DataSet will contain Tables as follows
Tbl_Parent( Parent_Id, Parent_Name)
Tbl_Child( Child_Id, Child_Name, Parent_Id)
Tbl_ChildOfChild(ChildOfChild_Id, ChildOfChild.Name, ChildOfChild.Child_Id)

Sample data with respect to the above columns
Tbl_Parent
( Parent_Id, Parent_Name)
1 "A"
----------------------------------------------------------------------------
----------------

Tbl_Child
(Child_Id, Child_Name, Parent_Id)
1 "a" 1
2 "b" 1
3 "c" 1
----------------------------------------------------------------------------
----------------

Tbl_ChildOfChild
(ChildOfChild_Id, ChildOfChild.Name, ChildOfChild.Child_Id)
1 "aa" 1
2 "bb" 1
1 "aa" 2
2 "bb" 2
3 "cc" 2
1 "aa" 3
----------------------------------------------------------------------------
----------------
Tbl_ChildOfChild
1 "aa"
2 "bb"

I would like to get the data into a single DataTable
as follows;

1 "A" 1 "a" 1 "aa"
1 "A" 1 "a" 2 "bb"
1 "A" 2 "b" 1 "aa"
1 "A" 2 "b" 2 "bb"
1 "A" 2 "b" 3 "cc"
1 "A" 3 "c" 1 "aa"
Any suggestions??
Shibu
Sep 5 '05 #1
1 1489
On Mon, 5 Sep 2005 22:14:12 +0530, "Shibu" <sh*****@yahoo.com> wrote:
Hi,
What is the best way to convert DataSet containing parent child relations
into a single DataTable (Flatten)


I've recently completed a series of projects that will do exactly what
you're asking for. It will allow you to execute a select statement
with join syntax that will create a "flattened" resultset

Joining ADO.Net DataTables:
http://home.hot.rr.com/graye/Article...TableJoins.htm
In-Memory SQL Engine:
http://home.hot.rr.com/graye/Articles/SQL_Engine.htm
Sep 11 '05 #2

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. ...
1
by: Shibu | last post by:
Hi, What is the best way to convert DataSet containing parent child relations into a single DataTable (Flatten) For eg:- DataSet will contain Tables as follows Tbl_Parent( Parent_Id,...
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.
2
by: Jim Heavey | last post by:
Hello I turned Option Strict on and after I did, I am getting an error of "Option Explicit does not allow late binding". OK great, now it is time to learn how to create a strongly typed dataset....
5
by: Roy Lawson | last post by:
I am having no problems connecting to a DB, creating a DataAdapter, and creating a dataset...and connecting to the data. Using the builtin data objects to do all this. My only problem now is...
22
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
3
by: BillJohnson4 | last post by:
Experts: I have built an in-memory dataset by parsing a flat file so that I can display the contents onto a datagrid. The Microsoft C# .NET System.Data.DataTable.Select() method allows me to...
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...
2
by: id10t error | last post by:
Hello, I am working on a project where I read in data from a flat file using a dataset .The program than lets the user scan the barcode. The problem is when the person scans a barcode on another...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.