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. C#
  4. How to persist datareader

How to persist datareader

Scheduled Pinned Locked Moved C#
csharpdatabasewinformssysadminperformance
4 Posts 4 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.
  • A Offline
    A Offline
    AndrusM
    wrote on last edited by
    #1

    My C# WinForms 1.1 application uses same datareader query a lot of times and it is allowed that it can use cached result from previous datareader creation. How to cache result obtained by datareader in memory so that in next time cached query result is returned instead of making trip to server? Or is it better to use DataTable and cache DataTable in memory?

    Andrus

    G K S 3 Replies Last reply
    0
    • A AndrusM

      My C# WinForms 1.1 application uses same datareader query a lot of times and it is allowed that it can use cached result from previous datareader creation. How to cache result obtained by datareader in memory so that in next time cached query result is returned instead of making trip to server? Or is it better to use DataTable and cache DataTable in memory?

      Andrus

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      A DataReader only reads the data from the database, it doesn't contain the data. So if you want to persist the data, a DataSet or a DataTable would be what you would use.

      --- Year happy = new Year(2007);

      1 Reply Last reply
      0
      • A AndrusM

        My C# WinForms 1.1 application uses same datareader query a lot of times and it is allowed that it can use cached result from previous datareader creation. How to cache result obtained by datareader in memory so that in next time cached query result is returned instead of making trip to server? Or is it better to use DataTable and cache DataTable in memory?

        Andrus

        K Offline
        K Offline
        karam chandrabose
        wrote on last edited by
        #3

        Datareader is always connected, better go for datatable to persist stuff!

        1 Reply Last reply
        0
        • A AndrusM

          My C# WinForms 1.1 application uses same datareader query a lot of times and it is allowed that it can use cached result from previous datareader creation. How to cache result obtained by datareader in memory so that in next time cached query result is returned instead of making trip to server? Or is it better to use DataTable and cache DataTable in memory?

          Andrus

          S Offline
          S Offline
          sno 1
          wrote on last edited by
          #4

          be more explicit, and tell my if you need still this answer yet regards

          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