What should you do

A. Use the DataSet.Reset method.

B. Set the RowFilter property of the DataSet object by using a filter expression.

C. Create a DataView object and set the RowFilter property by using a filter expression.

D. Create a DataView object and set the RowStateFilter property by using a filter expression.

Answer: C

Explanation: You filter data by setting the RowFilter property. The RowFilter property takes a String that can evaluate to an expression to be used for selecting records. RowFilter is a property of the DataView object.

Reference: Visual Basic and Visual C# Concepts, Filtering and Sorting Data Using Data Views

Incorrect Answers

A: The DataSet-Reset method resets the DataSet to its original state. B: RowFilter is not a property of the DataSet object.

D: The RowStateFilter property is used to filter based on a version or state of a record. Filter expressions cannot be used on RowStateFilters. The RowStates are Added, CurrentRows, Deleted, ModifiedCurrent, ModifiedOriginal, None, OriginalRows, and Unchanged.

QUESTION NO: 114

You develop a Windows-based application. The application uses a DataSet object that contains two DataTable objects. The application will display data from the two data tables. One table contains customer information, which must be displayed in a data-bound ListBox control. The other table contains order information, which must be displayed in a DataGrid control.

You need to modify your application to enable the list box functionality. What should you do?

A. Use the DataSet.Merge method.

B. Define primary keys for the DataTable objects.

C. Create a foreign key constraint on the DataSet object.

D. Add a DataRelation object to the Relation collection of the DataSet object.

Answer: D

Explanation: You can use a DataRelation to retrieve parent and child rows. Related rows are retrieved by calling the GetChildRows or GetParentRow methods of a DataRow.

Note: A DataRelation object represents a relationship between two columns of data in different tables. The DataRelation objects of a particular DataSet are contained in the Relations property of the DataSet. A DataRelation is created by specifying the name of the DataRelation, the parent column, and the child column.

Reference: 70-306/70-316 Training kit, Retrieving Related Records, Page 286

Incorrect Answers

A: The Merge method is used to merge two DataSet objects that have largely similar schemas. A merge does not meet the requirements of the scenario however. B: Primary keys would not help relating the DateTable objects.

C: Foreign key constraints put restrictions on the data in two different tables. However, it would not help in retrieving related records.

QUESTION NO: 115

You execute a query on your external Oracle database named TestKingSalesDate by using an OleDbCommand object. The query uses the Average function to return a single value that represents the average price of products in the inventory table. You want to optimize performance when you execute this query.

To execute this query from your ADO.NET code, you need to use a method of the OleDbCommand object. Which method should you use?

A. ExecuteNonQuery

B. ExecuteScalar

C. ToString

D. ExecuteReader

Answer: B

Explanation: The ExecuteScalar method returns the first column of the first row of data returned by the command, no matter how many rows the command actually selects.

Reference: 70-306/70-316 Training kit, The Command Object, Pages 252-253

Incorrect Answers

A: .The ExecuteNonQuery method executes the data command, but returns no value. C: The command object has no ToString method.

D: The ExecuteReader method returns a DataReader object that can iterate through a result set in a forward-only, read-only manner without involving a DataAdapter.

QUESTION NO: 116

You use Visual Studio .NET to develop a Windows-based application. Your application includes a form named TestKingInformationForm, which enables users to edit information stored in a database. All user changes to this information must be saved in the database.

You need to write code that will prevent TestKingInformationForm from closing if any database changes are left unsaved. What should you do?

A. Include Me.Activate in the Closing event handler of TestKingInformationForm.

B. Include Me.Activate in the Closed event handler of TestKingInformationForm.

C. Include Me.Activate in the Leave event handler of TestKingInformationForm.

D. Change a property of the System.ComponentModel.CancelEventArgs parameter in the Closing event handler of TestKingInformationForm.

E. Change a property of the System.EventArgs parameter in the Closed event handler of TestKingInformationForm.

F. Change a property of the System.EventArgs parameter in the Leave event handler of TestKingInformationForm.

0 0

Post a comment