Answer Posted / sivasaravanan
Data caching:
DataView Source;
//Declare variable for caching
Source = (DataView)Cache["MyDataset"];
if (Source == null)
{
OleDbConnection objcon = new OleDbConnection
(ConfigurationManager.ConnectionStrings
["strcon"].ConnectionString);
OleDbDataAdapter objcmd = new OleDbDataAdapter
("select * from Customer", objcon);
DataSet objds = new DataSet();
objcmd.Fill(objds, "Customer");
Source = new DataView(objds.Tables["Customer"]);
Cache["MyDataset"] = Source;
Label1.Text = "Dataset created explicitly";
}
else
{
Label1.Text = "Dataset retrived from Cache";
}
GridView1.DataSource = Source;
GridView1.DataBind();
gridbind();
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are Caching techniques in .NET
What are directives in asp.net?
What is data grid view in asp.net?
Write a code snippet to implement the indentation in json in web api.
How can we prevent browser from caching an aspx page?
What is difference between singleton and single call?
How to register exception filter globally?
What is Razor View Engine
What is the difference between user control and custom control?
What is a session in programming?
Do you know about caching with the datasource controls?
Differentiate between file-based dependency and key-based dependency.
Which is an advantage of application service providers?
What is the purpose of session management?
What are the advantages of asp.net?