Question Many To Many Relationship In Windows Form How I Represented It(Need Only Forms Nocode


Jan 22, 2014
Programming Experience
I make many to many relationship in erd diagram in sql server 2005 between ca and driver as following
car table
driver table
car_driver table.
I need to make fleet management program. When I make forms in windows form are i make car form driver form car_driver form When i insert data are creating three forms each form insert to related tables
car table car form
driver table driver form
car_driver table car_driver form

please help me
It's up to you how you represent the relationship. In the database you need the extra table but in your C# code you have a choice. Normally you wouldn't have a class to represent the join table but that's up to you. You can just have a Car class and a Driver class where the Car class has a Drivers property that is a collection of Driver objects and the Driver class has a Cars property that is a collection of Car objects.

In the UI, again, it's up to you how you represent the relationship. You might have form for a Car that allows you to select Drivers from a list on that form or a popup dialogue and the analogue for Cars of a Driver and that's normally how it would be done but it's up to you. Think about how other software that you've used works and think about how you would want an application of this type to work. It's your app so it works how you want it to work.
Top Bottom