DM
Dennis McCarthy
August 15, 2003 04:58 PM UTC
Here's how I got this to work:
1) Read the STUDENTS, COURSES and ENROLLMENTS tables into
a DataSet.
2) Add two DataRelations to the DataSet. One has STUDENTS
as the parent and ENROLLMENTS as the child. The other has
COURSES as the parent and ENROLLMENTS as the child.
3) Add computed DataColumn's to the ENROLLMENTS DataTable
in the DataSet. These columns correspond to columns in
the COURSES table. Their expression is along the lines
of "Parent(COURSE_ENROLLMENTS).COURSE_NAME".
4) Bind the master grid to the STUDENTS DataTable in the
DataSet.
5) Bind the detail grid to the ENROLLMENTS DataTable in
the DataSet. It will appear as if the detail grid is
bound to the COURSES table, since the ENROLLMENTS
DataTable contains the COURSES columns.
The master grid will display all students. The detail
grid will display only the courses in which the student
(row selected in the master grid) is enrolled.
Dennis