What should you do?

Your Microsoft SQL Server database contains a table named Regions. Regions contains all the sales regions for a sales-tracking application. You create a DataSet object named regionsDataSet by using a SqlDataAdapter object named myDataAdapter. This object uses a single SQL SELECT statement to populate the regionsDataSet. You bind regionsDataSet to a DataGrid object named regionsDataGrid to display the contents of Regions. You now want to use the same regionsDataSet, myDataAdapter, and regionsDataGrid to insert, update, and delete data in Regions. You want to accomplish this task by writing the minimum amount of code. What should you do?

Your Microsoft SQL Server database contains a table named Regions. Regions contains all the sales regions for a sales-tracking application. You create a DataSet object named regionsDataSet by using a SqlDataAdapter object named myDataAdapter. This object uses a single SQL SELECT statement to populate the regionsDataSet. You bind regionsDataSet to a DataGrid object named regionsDataGrid to display the contents of Regions. You now want to use the same regionsDataSet, myDataAdapter, and regionsDataGrid to insert, update, and delete data in Regions. You want to accomplish this task by writing the minimum amount of code. What should you do?

A.
Instantiate a SqlCommandBuilder object that has myDataAdapter as a constructor argument.
Add an Update button to the form and add code to the Click event to update regionsDataSet by using myDataAdapter.

B.
Instantiate a SqlCommandBuilder object that has myDataAdapter as a constructor argument.
Create one stored procedure for each of the insert, update, and delete functions and associate the stored procedures with the
InsertCommand, UpdateCommand, and DeleteCommand properties of myDataAdapter.
Add an Update button to the form and add code to the Click event to update regionsDataSet by using myDataAdapter.

C.
Create one stored procedure for each of the insert, update, and delete functions and associate the stored procedures with the
InsertCommand, UpdateCommand, and DeleteCommand properties of myDataAdapter.
Add an Update button to the form and add code to the Click event to update regionsDataSet by using myDataAdapter.

D.
Create one SQL string for each of the insert, update, and delete functions and associate the SQL strings with the InsertCommand,
UpdateCommand, and DeleteCommand properties of myDataAdapter.
Add an Update button to the form and add code to the Click event to update regionsDataSet by using myDataAdapter.



Leave a Reply 0

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