Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Whats wrong with this code

Reply
Thread Tools

Whats wrong with this code

 
 
ThatsIT.net.au
Guest
Posts: n/a
 
      04-07-2007
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()
__________________________________________

 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      04-07-2007
On Apr 7, 7:12 pm, "ThatsIT.net.au" <me@thatsit> wrote:
> 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)
.....

 
Reply With Quote
 
 
 
 
ThatsIT.net.au
Guest
Posts: n/a
 
      04-08-2007

"Alexey Smirnov" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> On Apr 7, 7:12 pm, "ThatsIT.net.au" <me@thatsit> wrote:
>> 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)
> ....



Seems to have done the trick, thanks


>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
whats wrong with this code??? Vineeth V VHDL 2 02-19-2007 10:35 PM
Whats wrong with this code.... is0871@gmail.com Java 10 04-11-2005 03:22 AM
whats wrong with this simple code? Robert Smith C++ 2 04-28-2004 01:01 AM
Whats wrong with this crc32 code? Matthew Wilson C Programming 1 02-17-2004 04:40 AM
Whats wrong in this code?? Tinus HTML 2 09-03-2003 10:04 PM



Advertisments