473,626 Members | 3,325 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Issue with SQLCacheDepende ncy

Hey Guys,

I have been struggling with this for few days. when i use

SqlCacheDepende ncy sqlDependency=n ew
SqlCacheDepende ncy("test","dbo .USStates");

where test is the name of connectionstrin g and dbo.USStates is the table
name everything works fine.

but when i use
using (SqlConnection conn=new SqlConnection(c onnectionString ))

{

SqlCommand command = new SqlCommand("[dbo].[USStatesGet]", conn);

command.Command Type = CommandType.Sto redProcedure;

SqlCacheDepende ncy sqlDependency = new SqlCacheDepende ncy(command);

}

HttpRuntime.Cac he.Insert(cache Name, ds, sqlDependency,
Cache.NoAbsolut eExpiration,Cac he.NoSlidingExp iration);

then the cache is not being invalidated when the values are changed in the
table

the following is the stored procedure i am using
set ANSI_NULLS ON

set QUOTED_IDENTIFI ER ON

GO

ALTER PROCEDURE [dbo].[USStatesGet]

-- Add the parameters for the stored procedure here

AS

BEGIN

--SET NOCOUNT OFF;

SELECT [stateid]

,[statename]

FROM [dbo].[USStates]

END

Thanks in Advance

Param
Oct 29 '07 #1
1 2092
assuming your using sql2005, sqlcachedepende ncy uses sql2005 query
notification (otherwise, it just polls using the query). query
notification has several restrictions. see:

http://msdn2.microsoft.com/en-US/library/ms181122.aspx

-- bruce (sqlwork.com)

pa***@community .nospam wrote:
Hey Guys,

I have been struggling with this for few days. when i use

SqlCacheDepende ncy sqlDependency=n ew
SqlCacheDepende ncy("test","dbo .USStates");

where test is the name of connectionstrin g and dbo.USStates is the table
name everything works fine.

but when i use
using (SqlConnection conn=new SqlConnection(c onnectionString ))

{

SqlCommand command = new SqlCommand("[dbo].[USStatesGet]", conn);

command.Command Type = CommandType.Sto redProcedure;

SqlCacheDepende ncy sqlDependency = new SqlCacheDepende ncy(command);

}

HttpRuntime.Cac he.Insert(cache Name, ds, sqlDependency,
Cache.NoAbsolut eExpiration,Cac he.NoSlidingExp iration);

then the cache is not being invalidated when the values are changed in the
table

the following is the stored procedure i am using
set ANSI_NULLS ON

set QUOTED_IDENTIFI ER ON

GO

ALTER PROCEDURE [dbo].[USStatesGet]

-- Add the parameters for the stored procedure here

AS

BEGIN

--SET NOCOUNT OFF;

SELECT [stateid]

,[statename]

FROM [dbo].[USStates]

END

Thanks in Advance

Param

Oct 29 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2853
by: stewart | last post by:
I've got the standard SqlCacheDependency working just fine , ie. I've defined (and encrypted) the connectionStrings section in the web.config, and I've also defined an an sqlCacheDependency in the caching section. So, in my code I add an item to the cache with an sqlCacheDependency, referencing the named sqlCacheDependency in the web.config and the database table it is to be based on (have enabled notificiations for that table). Fine. ...
5
2432
by: Adrian Parker | last post by:
I've got the standard SqlCacheDependency working just fine , ie. I've defined (and encrypted) the connectionStrings section in the web.config, and I've also defined an an sqlCacheDependency in the caching section. So, in my code I add an item to the cache with an sqlCacheDependency, referencing the named sqlCacheDependency in the web.config and the database table it is to be based on (have enabled notificiations for that table). Fine. ...
2
2065
by: chris | last post by:
Hello all, Background: Using .NET 2.0, Sql Server 2005, SqlCacheDependency is utilized successfully against SqlCommand objects elsewhere in the code (in other words I have successful instances of using SqlCacheDependency). ASP.NET website built in 3 separate tiers: Presentation, Business Logic Layer (BLL), and Data Access Layer (DAL). I have a strongly typed data set that is utilized by my BLL and returns
0
1436
by: Jayender | last post by:
I read an article : MSDN help topic. This will get you on the right track. http://msdn2.microsoft.com/en-us/library/system.web.caching.sqlcachedependency.aspx and its really amazing .. I tried it out and got succeeded , now I just want to know whether is there any possibility to update the cache once I change the database , say: I have inserted the data's ( which is from database to dataset) into the cache for the first time and now...
10
4563
by: J055 | last post by:
Hi I've been trying out SqlCacheDependency using the ObjectDataSource and SQL Server 2005. It all works quite well with the minimum of configuration, e.g. <asp:ObjectDataSource ID="odsAccounts" runat="server" ... EnableCaching="true" SqlCacheDependency="CommandNotification"> .... </asp:ObjectDataSource>
0
1799
by: Anthony Paul | last post by:
Hello everyone, I'm looking into SQL Server 2005's Notification Services and wasn't able to find a way to create a notification event service based on a DML event such as an Insert or an Update (looking into an alternative to triggers). I see that the SqlCacheDependency is based on some internal event mechanism and I'm wondering whether we can tap into it. Does anyoen have any details on what event or mechanism the SqlCacheDependency is...
4
5832
by: Reinout | last post by:
Hi I set up a sql cache dependency, but always receive a "DependencyChanged" notification straight away (through CacheItemRemoved callback). Modifying the procedure didn't help me. It used to work running on a SQL 2000 database with a SqlDataSource and a few things set in the configuration file. The current setup is using SQL 2005 Express and caching in the datalayer/business objects. Running profiler, I notice events ran by the...
1
3584
by: mark4asp | last post by:
Help: SQLCacheDependency not working. When I step through my code with the debugger I notice that the condition below: (cacheItem == null) is always true. I have setup SQLCacheDependency to work with 11 tables in the database. When I update the database without actually changing the "PensionFund" table then I notice that the Cache is being invalidated
7
1540
by: Adrian | last post by:
Hi, I'm trying to add caching to our asp app, but am having problems with the SQLCacheDependancy not invalidating the cache when the table changes. Using vs2008, sqlserver 2005 developer edition. So far I've added the following to the application_start event.. System.Data.SqlClient.SqlDependency.Start("connectionstring as the sa user") and against the db, I did
0
8199
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2626
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.