SQL Server Cache dependency not working -
06-14-2009
, 10:11 PM
I am using Visual Studio and asp.net. My main page shows a summary list of
all accounts. The data source for the select is a SQL Server stored procedure
that accesses 3 tables. A button on the page can redirect the user to a page
for entering a new account. That page can insert data into all 3 tables.
After the insert stored procedure runs, I redirect the user back to the first
page but the new data does not show up there. Here is how I set up the cache
dependency:
1. From Visual Studio, command line, aspnet_regsql, I enabled database cache
dependency and also ran it for 4 table ( the 3 referenced above and one more
that I want to reflect updates.) Note my -S had to refer to a named instance
(localhost didn't work) because I can be running different instances on my
computer for different projects. This seemed to work fine and generate the
proper tables.
2. I added a <caching> element to <system.web> in web.config:
<caching>
<sqlCacheDependency enabled="true">
<databases>
<add name="AdminiSafe"
connectionStringName="AdminiSafeConnectionString2" />
</databases>
</sqlCacheDependency>
</caching>
3. To my SQLDataSource on my main master page (the datasource and master are
used on multiple pages - so they are defined in a master), I added to Enable
Caching =" true":
CacheDuration="3600"
SqlCacheDependency="AdminiSafe:Table1;AdminiSafe:T able2;AdminiSafe:Table3"
This all had no effect. The new data I inserted into the tables did not show
up on the main page until the CacheDuration passed. Did I miss something? Is
there a problem because I am using a master page? |