Whats wrong with this code

Discussion in 'ASP .Net' started by ThatsIT.net.au, Apr 7, 2007.

  1. 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()
    __________________________________________
    ThatsIT.net.au, Apr 7, 2007
    #1
    1. Advertising

  2. 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)
    .....
    Alexey Smirnov, Apr 7, 2007
    #2
    1. Advertising

  3. "Alexey Smirnov" <> wrote in message
    news:...
    > 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


    >
    ThatsIT.net.au, Apr 8, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    10
    Views:
    717
  2. Tinus

    Whats wrong in this code??

    Tinus, Sep 2, 2003, in forum: HTML
    Replies:
    2
    Views:
    516
    Samuël van Laere
    Sep 3, 2003
  3. Robert Smith

    whats wrong with this simple code?

    Robert Smith, Apr 27, 2004, in forum: C++
    Replies:
    2
    Views:
    329
    Christopher Benson-Manica
    Apr 28, 2004
  4. Matthew Wilson

    Whats wrong with this crc32 code?

    Matthew Wilson, Feb 16, 2004, in forum: C Programming
    Replies:
    1
    Views:
    532
    Jack Klein
    Feb 17, 2004
  5. Vineeth V

    whats wrong with this code???

    Vineeth V, Feb 19, 2007, in forum: VHDL
    Replies:
    2
    Views:
    419
    R Quijano
    Feb 19, 2007
Loading...

Share This Page