PrepAway - Latest Free Exam Questions & Answers

You need to cache the retrieved data so that the database is not queried each time the Web page is accessed

You are implementing an ASP.NET Web application that retrieves data from a Microsoft SQL Server database.
You add a page that includes the following data source control.
<asp:SqlDataSource id=”sqlds” runat=”server” ConnectionString=”<%$
ConnectionStrings:MyDB %>” SelectCommand=”SELECT * FROM Companies” />
The page is accessed frequently, but the data in the database rarely changes.
You need to cache the retrieved data so that the database is not queried each time the Web page is accessed.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Add the following attributes to the SqlDataSourcecontrol.
DataSourceMode=”DataSet”
EnableCaching=”True”
CacheDuration=”120″

B.
Add the following attributes to the SqlDataSourcecontrol.
DataSourceMode=”DataReader”
EnableCaching=”True”
CacheDuration=”120″

C.
Add the following configuration to the <system.web/> section of the web.config file.
<caching>
<sqlCacheDependency enabled=”true”>
<databases>
<add name=”MyDBCache” connectionStringName=”MyDB” pollTime=”120″ /
>
</databases>
</sqlCacheDependency>
</caching>

D.
Add the following configuration to the <system.web/> section of the web.config file.
<caching>
<sqlCacheDependency enabled=”true” pollTime=”120″>
<databases>
<add name=”MyDBCache” connectionStringName=”MyDB” />
</databases>
</sqlCacheDependency>
</caching>


Leave a Reply