Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Cache datatable [modified]

Cache datatable [modified]

Scheduled Pinned Locked Moved Visual Basic
csharp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    helelark123
    wrote on last edited by
    #1

    Hello, I am writting an aplication in VB.NET (not a website) I would like to cache a datatable to save time when loading program, I will fill the datatable according to cache. Here my code: Imports System.Web.HttpRuntime dtSynchronize = DirectCast(Cache("dtSynchronize"), DataTable) If dtSynchronize Is Nothing Then dtSynchronize = New DataTable dtSynchronize.Columns.Add("EntryID", System.Type.GetType("System.String")) dtSynchronize.Columns.Add("SyncData", System.Type.GetType("System.String")) dtSynchronize.Columns.Add("StoreID", System.Type.GetType("System.String")) End If dtSynchronize.Rows.Clear() dtSynchronize.Rows.Add("1", "2", "3") Cache.Insert("dtSynchronize", dtSynchronize) It works fine but when I am closing the application and opening it again, I expect that after the first line of code the dtSynchronize will not be Nothing but it is. The cache is not saved. Thank you

    Shay Noy

    modified on Tuesday, September 8, 2009 5:41 AM

    H 1 Reply Last reply
    0
    • H helelark123

      Hello, I am writting an aplication in VB.NET (not a website) I would like to cache a datatable to save time when loading program, I will fill the datatable according to cache. Here my code: Imports System.Web.HttpRuntime dtSynchronize = DirectCast(Cache("dtSynchronize"), DataTable) If dtSynchronize Is Nothing Then dtSynchronize = New DataTable dtSynchronize.Columns.Add("EntryID", System.Type.GetType("System.String")) dtSynchronize.Columns.Add("SyncData", System.Type.GetType("System.String")) dtSynchronize.Columns.Add("StoreID", System.Type.GetType("System.String")) End If dtSynchronize.Rows.Clear() dtSynchronize.Rows.Add("1", "2", "3") Cache.Insert("dtSynchronize", dtSynchronize) It works fine but when I am closing the application and opening it again, I expect that after the first line of code the dtSynchronize will not be Nothing but it is. The cache is not saved. Thank you

      Shay Noy

      modified on Tuesday, September 8, 2009 5:41 AM

      H Offline
      H Offline
      helelark123
      wrote on last edited by
      #2

      I found other solution by storing the datatble in a file and it works fine. Although, if someone has solution for storing it in a cache, please advise Thank you

      Shay Noy

      A 1 Reply Last reply
      0
      • H helelark123

        I found other solution by storing the datatble in a file and it works fine. Although, if someone has solution for storing it in a cache, please advise Thank you

        Shay Noy

        A Offline
        A Offline
        Ashfield
        wrote on last edited by
        #3

        As a cache is only an area of memory it will disappear when your application closes unless you save it to disk or a database

        Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

        H 1 Reply Last reply
        0
        • A Ashfield

          As a cache is only an area of memory it will disappear when your application closes unless you save it to disk or a database

          Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

          H Offline
          H Offline
          helelark123
          wrote on last edited by
          #4

          Thank you, I understood it later, I though it is the same cache like in ASP.net.

          Shay Noy

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups