PrepAway - Latest Free Exam Questions & Answers

Which of the following GUI-based data source classes will you use to accomplish the task?

You work as a Windows Application Developer for company Inc. The company uses Visual Studio
.NET 2008 as its application development platform. You create a Windows Forms application using
.NET Framework 3.5. The application contains a data-bound control. You want to display both
hierarchical and tabular data by using the data-bound control. Which of the following GUI-based
data source classes will you use to accomplish the task?

PrepAway - Latest Free Exam Questions & Answers

A.
XmlDataSource

B.
LinqDataSource

C.
ObjectDataSource

D.
SqlDataSource

Explanation:
You will use the XmlDataSource class to accomplish this task. The XmlDataSource class is used to
provide an XML data source to data-bound controls. It can be used by data-bound controls to exhibit
both hierarchical and tabular data. It is normally used to exhibit hierarchical XML data in read-only
states.

Since the XmlDataSource class is inherited from the HierarchicalDataSourceControl class, it works
with hierarchical data. It also implements the IDataSource interface and works with tabular or liststyle data.
Answer D is incorrect. The SqlDataSource class is used to represent a SQL database to data-bound
controls. It can be used with a data-bound control to get data from a relational database as well as
to edit, display, and sort data on a Web page with least or no code. The SqlDataSource class can
support any SQL relational database that can be connected using the ADO.NET provider, such as the
SqlClient, OleDb, Odbc, or OracleClient providers.
Answer C is incorrect. The ObjectDataSource class is used to represent a business object. The
business object gives data to data-bound controls in multi-tier Web applications. The
ObjectDataSource class allows users to use an ASP.NET data source control while retaining their
three-tier application architecture. The ObjectDataSource class makes use of reflection to construct
instances of business objects and to call methods on them to insert, update, retrieve, and delete
data. The ObjectDataSource class constructs and destroys an instance of the class for each method
call. However, it does not contain the object in memory for the lifetime of the Web request.
Answer B is incorrect. The LinqDataSource class is used to allow the use of LINQ in ASP.NET Web
pages by using the markup text to fetch and modify the data from a data object. It uses LINQ to SQL
to automatically generate the data commands. The data object can be either an in-memory data
collection or an object that displays data from a database. A user can fetch or alter the data without
writing SQL commands for each operation.


Leave a Reply