What should you do to ensure that the details DataGridView control displays only the child rows of the selected master row?

You are creating a Windows Forms application that implements a master/detail form by using two DataGridView controls. You populate a dataset with a master table and a details table. You set the DataSource property of the master DataGridView control to the dataset. You set the DataMember property to the name of the master table. You also set the DataSource property of the details DataGridView control to the dataset. You need to ensure that the details DataGridView control displays only the child rows of the selected master row. What should you do?

You are creating a Windows Forms application that implements a master/detail form by using two DataGridView controls. You populate a dataset with a master table and a details table. You set the DataSource property of the master DataGridView control to the dataset. You set the DataMember property to the name of the master table. You also set the DataSource property of the details DataGridView control to the dataset. You need to ensure that the details DataGridView control displays only the child rows of the selected master row.

What should you do?

A.
Add a foreign key constraint to the dataset.
Set the DataMember property of the child DataGridView control to the name of the foreign key constraint.

B.
Define a data relation between the master table and details table in the dataset.
Set the DataMember property of the child DataGridView to the name of the data relation.

C.
Add a foreign key constraint to the dataset.
Set the DataMember property of the child DataGridView control to the name of the details table.

D.
Define a data relation between the master table and details table in the dataset.
Bind the details DataGridView control to the dataset.
Set the DataMember property of the child DataGridView control to the name of the details table.



Leave a Reply 0

Your email address will not be published. Required fields are marked *