Issue with SQLCacheDependency

G

Guest

Hey Guys,



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

SqlCacheDependency sqlDependency=new
SqlCacheDependency("test","dbo.USStates");

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

but when i use


using (SqlConnection conn=new SqlConnection(connectionString))

{

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

command.CommandType = CommandType.StoredProcedure;

SqlCacheDependency sqlDependency = new SqlCacheDependency(command);

}

HttpRuntime.Cache.Insert(cacheName, ds, sqlDependency,
Cache.NoAbsoluteExpiration,Cache.NoSlidingExpiration);



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_IDENTIFIER 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,965
Messages
2,570,148
Members
46,710
Latest member
FredricRen

Latest Threads

Top