I am in the proccess of writing a small membership program and all the info is being stored in an MS Access database. I've gotten stumped on coding the datagridview's "DataRelation" object because I'm having to code through three table levels.
To explain, I want to create families (Father, Mother, Children) and link them through the DataGridview.
I have a master table called "tblFamilyNames" that holds the "primary key" and anniversary date. I then have a table called tblFamilyDetails. It links the family(Father, Mother, Children) together by storing the primary key value from tblFamilyNames in a column called "intFamilyID".
In tblFamilyDetails, there is a column: "intMemberID" that points to a record in the third table: tblMembers".
My question is, how do I bind the first table: "tblFamilyDetails" with the third table: "tblMembers" so that the user can see the member's info without seeing the intermediate table: "tblFamilyDetails"?
whittlerPosted Jul 7, 2007, 11:22 PM
It sounds to me like you need to create a new TableAdapter with a join. To do this, you to open the design window for your DataSet. You then right-click on the background canvas and add a TableAdapter. When you write the SQL statement for the new table, make sure it has the relevant join conditions to include the data that you want included.
You can then configure the DataGridView so that only the columns which you want to be visible will be displayed. Click on the Columns Property for the DataGridView control to attend to that. It will launch a column collection editor.