Hi guys,
I have been playing around with SqlCacheDependency this morning and need to raise an event in my application when the data changes in my database. I am testing with the following code:
protected void Page_Load(object sender, EventArgs e)
{
DataTable customers = (DataTable)Cache.Get("Customers");
if (customers == null)
{
customers = GetCustomers();
label1.Text = System.DateTime.Now.ToString() + " - Retrieved from Db";
}
else {
label1.Text = System.DateTime.Now.ToString() + " - Retrieved from Cache";
}
GridView1.DataSource = customers.DefaultView;
GridView1.DataBind();
}
Go to the complete details ...