While i perfrom sqlcache dependency i got the dependency polling error
i am using the following code to achieve the sqlcache dependency but i got the error that is Unable to connect to SQL database 'koti' for cache dependency polling. in the sqlCacheDependency statement and i give the web.config setting as follows
if (Cache["states"] == null)
{
// Create the cache dependency
SqlCacheDependency dep = new SqlCacheDependency("koti", "states");
string connectionString =ConfigurationManager .ConnectionStrings[
"constrkoti"].ConnectionString;
SqlConnection myConnection = new SqlConnection(connectionString);
SqlDataAdapter ad = new SqlDataAdapter("SELECT * from states", myConnection);
DataSet ds2 = new DataSet();
ad.Fill(ds2);
Label2.Text = "data is comming from database";
Cache.Insert("states", ds2, dep);
}
we.config:-
<connectionStrings>
<add name="constrKoti" connectionString ="data source=sparsh151/sqlexpress;database=koti;user id=sa;password=sparsh"/>
</connectionStrings>
<caching>
<sqlCacheDependency enabled="true ">
<databases>
<add connectionStringName ="constrkoti" name="koti" pollTime="500"/>
</databases>
</sqlCacheDependency>
</caching>