DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sun, 12 Aug 2007 13:21:26 +0300,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Toni
          2    Cowboy \(Gregory A. Beamer\) oSpamM
                 3    Toni


Help needed, ASP.NET caching with SQL Server doesn't work   
Hello! I'm trying to use ASP.NET caching with my web site and SQL Server, 
but I have a problem.

I try to do everything according to the instructions like this page here:
http://www.eggheadcafe.com/articles/20060407.asp

First I run the aspnet_regsql tool on the command line succesfully to enable 
the database for cache notification:
aspnet_regsql -S [SERVER] -E -d [database] -ed

Then I run the following command on the command line succesfully for each
table in the database:
aspnet_regsql -S [SERVER] -E -d [database] -et -t [table]

I added the necessary parts into the web.config file, so that it is like
this:

 <connectionStrings>
      <add name="ConnectionString1"
         connectionString="Server=servername;Database=databasename;Trusted_Connection=yes"
         />
   </connectionStrings>

    <caching>
      <sqlCacheDependency enabled="true" pollTime="2000">
        <databases>
          <add connectionStringName="ConnectionString1"
               name="KJ"/>

        </databases>
      </sqlCacheDependency>
    </caching>

Then I added the following line into the beginning of  the page default.aspx
<%@ OutputCache Duration="86400" VaryByParam="*"
SqlDependency="KJ:ILMOITUKSET" %>

But when I run the page default.aspx it gives the following error:
-----------------------------
The 'ILMOITUKSET' table in the database 'KJ' is not enabled for SQL cache
notification.

Please make sure the table exists, and the table name used for cache
dependency matches exactly the table name used in cache notification
registration.

To enable a table for SQL cache notification, please use
SqlCacheDependencyAdmin.EnableTableForNotifications method, or the command
line tool aspnet_regsql. To use the tool, please run 'aspnet_regsql.exe -?'
for more information.

To get a list of enabled tables in the database, please use
SqlCacheDependencyManager.GetTablesEnabledForNotifications method, or the
command line tool aspnet_regsql.exe.
-----------------------------------
When I run aspnet_regsql.exe with the -lt parameter to see the list of 
tables that are enabled for cache notification they are all enabled. Could 
someone help me with this problem and tell me what I'm doing wrong? Thank 
you so much in advance.

Toni
Date:Sun, 12 Aug 2007 13:21:26 +0300   Author:  

Re: Help needed, ASP.NET caching with SQL Server doesn't work   
First, are you using SQL Server 7 or 2000? They use the version of caching 
you talk about. If you are using SQL Server 2005, it is automatic when you 
use the SQLCacheDependency instead.

-- 
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************************************************
Think outside the box!
************************************************
"Toni"  wrote in message 
news:OCJuJqM3HHA.1164@TK2MSFTNGP02.phx.gbl...

> Hello! I'm trying to use ASP.NET caching with my web site and SQL Server, 
> but I have a problem.
>
> I try to do everything according to the instructions like this page here:
> http://www.eggheadcafe.com/articles/20060407.asp
>
> First I run the aspnet_regsql tool on the command line succesfully to 
> enable the database for cache notification:
> aspnet_regsql -S [SERVER] -E -d [database] -ed
>
> Then I run the following command on the command line succesfully for each
> table in the database:
> aspnet_regsql -S [SERVER] -E -d [database] -et -t [table]
>
> I added the necessary parts into the web.config file, so that it is like
> this:
>
> <connectionStrings>
>      <add name="ConnectionString1"
> 
> connectionString="Server=servername;Database=databasename;Trusted_Connection=yes"
>         />
>   </connectionStrings>
>
>    <caching>
>      <sqlCacheDependency enabled="true" pollTime="2000">
>        <databases>
>          <add connectionStringName="ConnectionString1"
>               name="KJ"/>
>
>        </databases>
>      </sqlCacheDependency>
>    </caching>
>
> Then I added the following line into the beginning of  the page 
> default.aspx
> <%@ OutputCache Duration="86400" VaryByParam="*"
> SqlDependency="KJ:ILMOITUKSET" %>
>
> But when I run the page default.aspx it gives the following error:
> -----------------------------
> The 'ILMOITUKSET' table in the database 'KJ' is not enabled for SQL cache
> notification.
>
> Please make sure the table exists, and the table name used for cache
> dependency matches exactly the table name used in cache notification
> registration.
>
> To enable a table for SQL cache notification, please use
> SqlCacheDependencyAdmin.EnableTableForNotifications method, or the command
> line tool aspnet_regsql. To use the tool, please run 
> 'aspnet_regsql.exe -?'
> for more information.
>
> To get a list of enabled tables in the database, please use
> SqlCacheDependencyManager.GetTablesEnabledForNotifications method, or the
> command line tool aspnet_regsql.exe.
> -----------------------------------
> When I run aspnet_regsql.exe with the -lt parameter to see the list of 
> tables that are enabled for cache notification they are all enabled. Could 
> someone help me with this problem and tell me what I'm doing wrong? Thank 
> you so much in advance.
>
> Toni
>
>
> 
Date:Sun, 12 Aug 2007 08:23:10 -0500   Author:  

Re: Help needed, ASP.NET caching with SQL Server doesn't work   
I am using SQL Server 2005 Express Edition. I tried to create the cache 
programmatically. I removed the line

 <%@ OutputCache Duration="86400" VaryByParam="*"

>> SqlDependency="KJ:ILMOITUKSET" %>


and wrote the following code:

SqlCacheDependencyAdmin.EnableTableForNotifications(ConfigurationManager.ConnectionStrings("ConnectionString1").ToString(),
"MAAKUNNAT")
Dim maakunnatDS As New DataSet

If Cache.Get("maakunnat") Is Nothing Then
            Dim myConnection As New
SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString1").ToString())
            myConnection.Open()

            Dim cmd As New SqlCommand("haemaakunnat", myConnection)
            cmd.CommandType = CommandType.StoredProcedure
            Dim riippuvuus As New SqlCacheDependency("KJ", "MAAKUNNAT")
            Dim aggDep As New AggregateCacheDependency
            aggDep.Add(riippuvuus)

            Dim maakunnatDA As SqlDataAdapter = New SqlDataAdapter
            maakunnatDA.SelectCommand = cmd

            maakunnatDA.Fill(maakunnatDS, "MAAKUNTA")
            myConnection.Close()
            Cache.Insert("maakunnat", maakunnatDS, aggDep)

        Else
            Response.Write("The data is in the cache")
            maakunnatDS = Cache.Get("maakunnat")
End If

I added into global.asax line:
        System.Data.SqlClient.SqlDependency.Start(ConfigurationManager.ConnectionStrings("ConnectionString1").ToString())

I still get the same error.

Toni S:



"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@comcast.netNoSpamM> kirjoitti 
viestiss:O%23NkuPO3HHA.2312@TK2MSFTNGP06.phx.gbl...

> First, are you using SQL Server 7 or 2000? They use the version of caching 
> you talk about. If you are using SQL Server 2005, it is automatic when you 
> use the SQLCacheDependency instead.
>
> -- 
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> http://gregorybeamer.spaces.live.com
> Co-author: Microsoft Expression Web Bible (upcoming)
>
> ************************************************
> Think outside the box!
> ************************************************
> "Toni"  wrote in message 
> news:OCJuJqM3HHA.1164@TK2MSFTNGP02.phx.gbl...
>> Hello! I'm trying to use ASP.NET caching with my web site and SQL Server, 
>> but I have a problem.
>>
>> I try to do everything according to the instructions like this page here:
>> http://www.eggheadcafe.com/articles/20060407.asp
>>
>> First I run the aspnet_regsql tool on the command line succesfully to 
>> enable the database for cache notification:
>> aspnet_regsql -S [SERVER] -E -d [database] -ed
>>
>> Then I run the following command on the command line succesfully for each
>> table in the database:
>> aspnet_regsql -S [SERVER] -E -d [database] -et -t [table]
>>
>> I added the necessary parts into the web.config file, so that it is like
>> this:
>>
>> <connectionStrings>
>>      <add name="ConnectionString1"
>>
>> connectionString="Server=servername;Database=databasename;Trusted_Connection=yes"
>>         />
>>   </connectionStrings>
>>
>>    <caching>
>>      <sqlCacheDependency enabled="true" pollTime="2000">
>>        <databases>
>>          <add connectionStringName="ConnectionString1"
>>               name="KJ"/>
>>
>>        </databases>
>>      </sqlCacheDependency>
>>    </caching>
>>
>> Then I added the following line into the beginning of  the page 
>> default.aspx
>> <%@ OutputCache Duration="86400" VaryByParam="*"
>> SqlDependency="KJ:ILMOITUKSET" %>
>>
>> But when I run the page default.aspx it gives the following error:
>> -----------------------------
>> The 'ILMOITUKSET' table in the database 'KJ' is not enabled for SQL cache
>> notification.
>>
>> Please make sure the table exists, and the table name used for cache
>> dependency matches exactly the table name used in cache notification
>> registration.
>>
>> To enable a table for SQL cache notification, please use
>> SqlCacheDependencyAdmin.EnableTableForNotifications method, or the 
>> command
>> line tool aspnet_regsql. To use the tool, please run 
>> 'aspnet_regsql.exe -?'
>> for more information.
>>
>> To get a list of enabled tables in the database, please use
>> SqlCacheDependencyManager.GetTablesEnabledForNotifications method, or the
>> command line tool aspnet_regsql.exe.
>> -----------------------------------
>> When I run aspnet_regsql.exe with the -lt parameter to see the list of 
>> tables that are enabled for cache notification they are all enabled. 
>> Could someone help me with this problem and tell me what I'm doing wrong? 
>> Thank you so much in advance.
>>
>> Toni
>>
>>
>>
>
> 
Date:Fri, 17 Aug 2007 12:50:47 +0300   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us