1
Q:

You use Visual Studio .NET to develop a Windows-based application that interacts with a Microsoft SQL Server database. Your application contains a form named CustomerForm.

 You add the following design-time components to the form:

• SqlConnection object named XYZConnection.
• SqlDataAdapter object named XYZDataAdapter.
• DataSet object named XYZDataSet.
• Five TextBox controls to hold the values exposed by XYZDataSet.


At design time, you set the DataBindings properties of each TextBox control to the appropriate column in the DataTable object of XYZDataSet. When you test the application, you can successfully connect to the database. However, no data is displayed in any text boxes.

You need to modify your application code to ensure that data is displayed appropriately. Which behavior should occur while the CustomerForm.Load event handler is running?

A) Execute the BeginInit method of XYZDataSet. B) Execute the Open method of XYZConnection.
C) Execute the FillSchema method of XYZDataAdapter and pass in XYZDataSet. D) Execute the Fill method of XYZDataAdapter and pass in XYZDataSet.

Answer:   D) Execute the Fill method of XYZDataAdapter and pass in XYZDataSet.

Explanation:

Dataset is a container; therefore, you need to fill it with data. You can populate a dataset by calling the Fill method of a data adapter.