Interviewer And Interviewee Guide

ASP.NET Caching Interview Question:

Do you know about caching with the DataSource Controls?

Submitted by: Administrator
The DataSource controls enable you to cache database data while connecting a .NET application to a database. The DataSource control provides various properties, such as EnableCaching, which you can use to automatically cache the data represented by a DataSource control. The syntax to cache a database table in a memory for 120 seconds is:

<asp:SqlDataSource ID=”SqlDataSource1” EnableCaching=”True” CacheDuration=”120”
ConnectionString=”Server=localhost;database=AdventureWorks;uid=user;pwd=word;”
SelectCommand=”SELECT * FROM Production.ProductCategory” Runat=”server”/>

The above syntax caches a database table, ProductCategory, by setting the EnableCaching property of the DataSource control to True. The CacheDuration property of the DataSource control specifies the time, in seconds, for caching the data before it is updated in a database containing the ProductCategory table. The value of the Time parameter is set to 120 to cache data for two minutes.
Submitted by: Administrator

Read Online ASP.NET Caching Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.