DataSet and Session variables
-
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
-
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
-
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
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.
-
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
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
-
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