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

Flatten two tables in DataGridView?

I have a db with two tables, Parent and Child. A Parent will always
have 1 or 2 children: Child1, Child2, or both children. I'm writing a
C# windows app over these tables. The user, in a datagridview, will be
able to view, update, etc. the data.

Problem is, I have to flatten the two tables into one row in the dgv
per parent item. The three possible combinations, flattened, are shown
below:

Parent_ID1, Child_ID1, ChildID_2
Parent_ID2, ParentName2, Child_ID_1, null
Parent_ID3, ParentName3, null, ChildID_2

I have to display 20 or so fields for the parent and each of the 1-2
child rows. Any ideas how to handle this? I'm looking at creating a
temp table, flattening, then displaying on the grid. Others have
suggested flattening on the front end via DataTables. And how to
update the relational tables upon edit?

Thanks,

Burt

Apr 26 '07 #1
1 3046
On 26 Apr, 22:45, Burt <burt_5...@yahoo.comwrote:
I have a db with two tables, Parent and Child. A Parent will always
have 1 or 2 children: Child1, Child2, or both children. I'm writing a
C# windows app over these tables. The user, in a datagridview, will be
able to view, update, etc. the data.

Problem is, I have to flatten the two tables into one row in the dgv
per parent item. The three possible combinations, flattened, are shown
below:

Parent_ID1, Child_ID1, ChildID_2
Parent_ID2, ParentName2, Child_ID_1, null
Parent_ID3, ParentName3, null, ChildID_2

I have to display 20 or so fields for the parent and each of the 1-2
child rows. Any ideas how to handle this? I'm looking at creating a
temp table, flattening, then displaying on the grid. Others have
suggested flattening on the front end via DataTables. And how to
update the relational tables upon edit?

Thanks,

Burt
Windwos eh.
So extGridView would be no use to you.

I think I'd bind to an object.
So your object can serve up an iList of a type you define with all
the fields in it.
Then you can flatten whetever out in the Get method and make whatever
construct you fancy in the update.

But really, sticking everything in one gridview isn't so good an idea
if you could avoid that.
Apr 27 '07 #2

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

Similar topics

23
by: Francis Avila | last post by:
Below is an implementation a 'flattening' recursive generator (take a nested iterator and remove all its nesting). Is this possibly general and useful enough to be included in itertools? (I know...
18
by: Ville Vainio | last post by:
For quick-and-dirty stuff, it's often convenient to flatten a sequence (which perl does, surprise surprise, by default): ]]] -> One such implementation is at ...
181
by: Tom Anderson | last post by:
Comrades, During our current discussion of the fate of functional constructs in python, someone brought up Guido's bull on the matter: http://www.artima.com/weblogs/viewpost.jsp?thread=98196 ...
1
by: Lars E. | last post by:
Hi all. I am trying to combine data from 2 tables in one datagridview. I have tables: "Customer" and "CustomerContact". I want to display Customer information (displaying all fields in...
2
by: Steve Richter | last post by:
what is the best way to use DataGridView to view data from large database tables? Where the sql select statement might return millions of rows? string connectionString =...
25
by: beginner | last post by:
Hi, I am wondering how do I 'flatten' a list or a tuple? For example, I'd like to transform or ] to . Another question is how do I pass a tuple or list of all the aurgements of a function to...
2
by: rav500 | last post by:
I am using visual studio 2005, .NET2.0 I am reading xml data into a dataset and bind the it to a datagridview I have 2 tables in my xml that I would like to bind to the datagridview. Using...
0
by: Dennis Francek | last post by:
Hello I have populated a treeview from my dataset and by clicking in the treeview i want to get the corresponding table shown in a datagridview. Ive managed this by looking at each DataRow and...
1
by: msgjunkie | last post by:
I have 3 related tables in a DataSet - Customers, Products and Orders. I am trying to create an "editable" DataGridView which, ideally, will contain columns from all the tables. I have tried...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.