Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > N:M relations and DataGridView
 

N:M relations and DataGridView

Hello!

I have two tables related to each other in a n:m relation. To implement this relation I use a third connecting table. Let's say they have to following structure:

Table "User": ID, Username
Table "User-Groups": User_ID, Group_ID
Table "Group": ID, Groupname

A User can be in 0 or more groups and a group can have 0 or more users.

Now I need to display all users of a group in a datagridview.
Or all groups that a user belongs to.

I just have one datagridview - no master-child relation in any way on the same form. I want to filter the datagridview in the way I described.

How is the easiest way to perform this?

Thanks a lot!
TAS  Tuesday, September 06, 2005 9:39 AM
You can use 2 usercontrols to store different DataGridView and according to your filter, show or hide the goog usercontrol.
The grace  Tuesday, September 06, 2005 3:21 PM

Sorry - I don't know what you mean.

Do I have to build by own filter like "User_ID=<x> OR User_ID=<y> OR User_ID=<z>" according to the entries of the connecting table?
But this could be a quite long filter if a group has many members.

Has anybody else any ideas?

Thank you!

TAS  Thursday, December 08, 2005 1:00 PM

You can use google to search for other answers

Custom Search

More Threads

• Windows Application by C# VS 2005 !!!
• Binding at the OnPropertyChanged level
• Converting a datagridview cell value to an integer
• How to find Start Byte and EndByte
• Help! Number Pad Negative key not working in DataGrid ...
• Filling DataSet Problems.
• Is ListBox the only control in Forms to allow multiple selections?
• ISAM eerror
• CellValidating Event being fired on Load of Form
• Having trouble using the merge method in my code getting error violating Foreign Key Need Help!