[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

First time using Caching, getting compiler error, please help

Keithb

10/1/2006 10:16:00 PM

Can someone please point out what I am doing wrong here? The statement:

Cache.Insert("Svc_Table", dataSet.Tables["Svc"]);

causes the following compiler error:

"An object reference is required for the nonstatic field, method, or
property 'System.Web.Caching.Cache.Insert(string, object)'
C:\Interfaces\App_Code\FileSystemAccess.cs 37 9 C:\Interfaces\"

Any suggestions will be appreciated.

Thanks,

Keith



1 Answer

sloan

10/3/2006 8:50:00 PM

0



Did you try null checking it?

if(null!=dataSet)
{
if (null!=dataSet.Tables["Svc"])
{
//null checks pass ok
Cache.Insert("Svc_Table", dataSet.Tables["Svc"]);

}
}





"Keithb" <noreply@dslextreme.com> wrote in message
news:e2poqca5GHA.940@TK2MSFTNGP03.phx.gbl...
> Can someone please point out what I am doing wrong here? The statement:
>
> Cache.Insert("Svc_Table", dataSet.Tables["Svc"]);
>
> causes the following compiler error:
>
> "An object reference is required for the nonstatic field, method, or
> property 'System.Web.Caching.Cache.Insert(string, object)'
> C:\Interfaces\App_Code\FileSystemAccess.cs 37 9 C:\Interfaces\"
>
> Any suggestions will be appreciated.
>
> Thanks,
>
> Keith
>
>
>