my cached dataset just wont stay cached!!

Discussion in 'ASP .Net' started by Craig G, Mar 7, 2005.

  1. Craig G

    Craig G Guest

    is there something im doing wrong??

    the dataset is cached up until i click a button then when i try to retrieve
    it, it justs says its nothing!!

    this is code where it gets inserted into the cache

    Cache.Insert("myDS", dsResults, Nothing,
    System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(300))
    now if i query the cached dataset it shows that there is data in it!!

    but once i click my button and this code for the click button runs to try to
    retrieve it - it comes back saying the dsResults is 'nothing'

    Private Sub btnSearch_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles btnSearch.Click
    Dim strCode As String = txtCode.Text
    Dim strDescription As String = txtDescription.Text
    Dim strFilter As String
    Dim drFilteredRows As DataRow()
    Dim dtDataTable As New DataTable
    Dim dsResults As DataSet

    dsResults = CType(Cache.Item("myDS"), DataSet)
    strFilter = "Code='" & strCode & "' AND Description='" & strDescription &
    "'"
    drFilteredRows = dsResults.Tables(0).Select(strFilter)
     
    Craig G, Mar 7, 2005
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.