PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use to display the part data in a DataGridView control named testdataGridView?

You have called a stored procedure that returns a row set that has data about electrical chips. You then load the part data in a DataSet instance named testdataSet.
The DataSet has a single Data Table instance. The DataTable instance’s TableName property is set to Part.
Which code segment should you use to display the part data in a DataGridView control named testdataGridView?

PrepAway - Latest Free Exam Questions & Answers

A.
testdataGridView.DataSource = testdataSet. Tables[0];
testdataGridView.DataMember = "Part";

B.
testdataGridView.DataSource = testdataSet. Tables ["Part"];
testdataGridView.DataMember = "DataTable";

C.
testdataGridView.DataSource = testdataSet;
testdataGridView.DataMember = "Part";

D.
testdataGridView.DataSource = testdataSet;
testdataGridView.DataMember = "TableName.Part";

Explanation:
To obtain your objective you should set the DataGridView control DataSource property to the DataSet instance. You also should set the DataGridView control DataSource property to theDataMember property to part.

Incorrect Answers:
A, B, D: It is not good if you set the DataMember property if you set eh DataSource property to the DataTable instance which signifies the Part data. Furthermore, you should not set the DataMember property to TableName.Part.


Leave a Reply