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. Web Development
  3. ASP.NET
  4. DataSet and Session variables

DataSet and Session variables

Scheduled Pinned Locked Moved ASP.NET
databasetutorialquestiondiscussionlearning
5 Posts 5 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.
  • V Offline
    V Offline
    vcorn
    wrote on last edited by
    #1

    I just wanna ask opinions whether storing dataSet in session variables is a good idea, example i found from O'reilly book did this. I'm a bit disagree since it will not keep data up-to-date.Instead i prefer to retrieve from database each time page load and refill the dataset. how do u guys think about this? need opinion Thanks:-D

    M D S S 4 Replies Last reply
    0
    • V vcorn

      I just wanna ask opinions whether storing dataSet in session variables is a good idea, example i found from O'reilly book did this. I'm a bit disagree since it will not keep data up-to-date.Instead i prefer to retrieve from database each time page load and refill the dataset. how do u guys think about this? need opinion Thanks:-D

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      I don't think storing DataSet in a Session is a good idea cause it could to poor performance when DataSet grow. Refill from Database is better. Mazy
      "One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji

      1 Reply Last reply
      0
      • V vcorn

        I just wanna ask opinions whether storing dataSet in session variables is a good idea, example i found from O'reilly book did this. I'm a bit disagree since it will not keep data up-to-date.Instead i prefer to retrieve from database each time page load and refill the dataset. how do u guys think about this? need opinion Thanks:-D

        D Offline
        D Offline
        David Flores
        wrote on last edited by
        #3

        Most of the examples in the O'reilly books are just to show a working concept, which doesn't really fit into the real world situtation. You should not store the dataset in the session variable for many reasons, the biggest reason is data integratity. If some other process, person, service changes the database, the information stored in the session variable will be invalid which can lead to many problems. Just keep getting your data from the database, just be smart with your queries if performance is becoming an issue, e.g. dont just blinding call "SELECT * FROM Table" when you only need 1 column of data. Anyway, thats just my opinion.

        1 Reply Last reply
        0
        • V vcorn

          I just wanna ask opinions whether storing dataSet in session variables is a good idea, example i found from O'reilly book did this. I'm a bit disagree since it will not keep data up-to-date.Instead i prefer to retrieve from database each time page load and refill the dataset. how do u guys think about this? need opinion Thanks:-D

          S Offline
          S Offline
          sivilian
          wrote on last edited by
          #4

          I believe that session variables, when used in this way is a caching mechanism. As the cache object is only good application wide, the session object is the ideal method to cache data from individual users and can increase speed. However, the drawback to this is that it can consume lots of memory on the server if you have many users connected concurrently. There is an option to store session information in sql server if this is a problem for you. But as you say, session variables do not keep data up-to-date. This is true, but this is a fundamental issue with web applications in general. You can never keep data up-to-date on clients who do not post back to the server. How much would reloading data on every load help? Another way to do this is to use the viewstate, which is a better way because it does not put any load on server resources. It does slow down page loads since all the data is being past back and forth on every load. hope this helps, sivilian

          1 Reply Last reply
          0
          • V vcorn

            I just wanna ask opinions whether storing dataSet in session variables is a good idea, example i found from O'reilly book did this. I'm a bit disagree since it will not keep data up-to-date.Instead i prefer to retrieve from database each time page load and refill the dataset. how do u guys think about this? need opinion Thanks:-D

            S Offline
            S Offline
            Spanky3
            wrote on last edited by
            #5

            like the guys below say its poor when the datasets become large but for small datasets its fine. Why do you need to store this information as a session anyway? using the db will be better as its real-time.

            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