PrepAway - Latest Free Exam Questions & Answers

Which of the following represents a database connection that uses an ADO.NET provider such as SqlClient…

Which of the following represents a database connection that uses an ADO.NET provider such as
SqlClient or Odbc that enables a Web server control to access data located in a relational database?

PrepAway - Latest Free Exam Questions & Answers

A.
XmlDataSource

B.
SqlDataSource

C.
ObjectDataSource

D.
LinqDataSource

Explanation:
The SqlDataSource represents a database connection that uses an ADO.NET provider such as
SqlClient, Odbc, etc. The SqlDataSource control enables a Web server control to access data located
in a relational database. The SqlDataSource control can be used with data bound controls such as
GridView, FormView, and DetailsView to display and modify data on a Web page. It uses ADO.NET
classes to interact with any database supported by ADO.NET, such as Microsoft SQL Server and
Oracle.
Answer A is incorrect. XmlDataSource represents an XML data source to the data-bound controls
such as GridView and TreeView controls. Data-bound controls can use XmlDataSource to display
both hierarchical data and tabular data. The XmlDataSource control extends the
HierarchicalDataSourceControl class and works with hierarchical data. It also implements the
IDataSource interface; hence, it works with tabular data, or list style data.
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 D 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