Cache is not work in ASP.NET

  • Thread starter Thread starter Goran
  • Start date Start date
G

Goran

I have some code which put DataSet in Cache. But I have run time error
"Cache is not available". This is my code:

dsObject = Cache("Translate")
If dsObject Is Nothing Then
odbConn = New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Putanja)

SQL = "SELECT * FROM Translate_text WHERE ID='" & Word & "'"

odbAdapt = New OleDbDataAdapter(SQL, odbConn)
dsObject = New DataSet
odbAdapt.Fill(dsObject)
Cache.Insert("Translate", dsObject)
End If
dtObject = dsObject.Tables(0)

How to fix this problem? Do I need to change something in Windows or IIS or
mybe I need to write some aditional code?
 
Hi Goran,

Seems compiler probably wasn't able to resolve the Cache type. use
HttpContext.Current.Cache.Insert instead.
 
Back
Top