Whats wrong with this code

T

ThatsIT.net.au

Dim dis As System.Data.DataSet
If System.Web.HttpRuntime.Cache("search" & find) = "" Then
dis = oSearch.plainSearch(find, catelog, whereas)
System.Web.HttpRuntime.Cache("search" & find) = dis
Else
dis = CType(System.Web.HttpRuntime.Cache("search" & find),
System.Data.DataSet)
End If


This code returns a dataset from a web service, it works fine the first
time,

the second time it should return the dataset from cache, but never does.

At first I thought you may not be able to use ctype on a dataset, but
looking on the internet I find many examples of doing just that.

Any ideas why this code is not working
 
G

Guest

Dim dis As System.Data.DataSet
If System.Web.HttpRuntime.Cache("search" & find) = "" Then
dis = oSearch.plainSearch(find, catelog, whereas)
System.Web.HttpRuntime.Cache("search" & find) = dis
Else
dis = CType(System.Web.HttpRuntime.Cache("search" & find),
System.Data.DataSet)
End If

This code returns a dataset from a web service, it works fine the first
time,

the second time it should return the dataset from cache, but never does.

At first I thought you may not be able to use ctype on a dataset, but
looking on the internet I find many examples of doing just that.

Any ideas why this code is not working

--
Dim Alan as ThatsIT.net.au.Staffmember
Alan.signature = "Thank You"
Response.Write Alan.signature.toString()
__________________________________________

try

If (IsNothing(Cache("search" & find)) Then
dis = oSearch.plainSearch(find, catelog, whereas)
.....
 
T

ThatsIT.net.au

Anon User said:
try

If (IsNothing(Cache("search" & find)) Then
dis = oSearch.plainSearch(find, catelog, whereas)
....


Seems to have done the trick, thanks
 

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

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top