Select-Box (Please see the picture in the details) lazarus / 16-Databases ---------------------------------------------------------------------- anis2505 · 2014-12-20 13:04 Hi all, long time So I need to make a select-box ( PLZ take a look to The attached Picture ) It uses 2 TDBListBox. it's a many to many relationship Student 1..* <----------------------> 0..* Course So the list will contain the courses that a student has taken Any Idea how to make such thing. regards G.Anis ---------------------------------------------------------------------- anis2505 · 2014-12-20 16:15 Please, Tell me how you manage many to many relationship, Tell me how you do such thing not necessary using Select-Boxes. Thank you all ---------------------------------------------------------------------- engkin · 2014-12-20 17:04 Three tables: tblStudents, tblCourses, and tblStudentCourse. Example: tblStudents ID Name Etc... 1 S1 2 S2 ... n Sn tblCourses ID Name Etc... 1 C1 2 C2 ... m Cm When Student Sx takes a course Cy, add an entry in tblStudentCourse: ID SID CID Etc.... z Sx Cy As I see it, it is one to many relation ---------------------------------------------------------------------- anis2505 · 2014-12-20 17:26 Hi, Thanks for reply My problem isn't database design. it's about gui design I want to add the appropriate course for a student when entering the student main information I mean
---------------------------------------------------------------------- goodname · 2014-12-20 17:48 If your dealing with one student or one course at a time then design two one to many screens. Had a case once where I was adding many people to many groups in one step. The GUI had two multi-select list boxes with the items to be linked in each box selected. ---------------------------------------------------------------------- engkin · 2014-12-20 17:57 If the concept you have in your image is good enough, then replace TDBListBox with TListBox and build the logic in code. ---------------------------------------------------------------------- anis2505 · 2014-12-20 18:18 I guess I will do as you sad. Thank you ---------------------------------------------------------------------- marcov · 2014-12-20 18:50 Your relation is many to many, but the dialog is not that is one to many. I think it might even behave good enough to use master-detail relations prepared in data sets. Search for "lazarus master detail" or so.