Session or Recordset

liunx

Guest
Hi,

this question may belong in the 'database' forum, not sure ...

I was wondering what is more efficient and/or uses less server resources: Setting/Retrieving a Session variable or opening a Recordset?
I have a member section on my web site and after logging in, I currently store the memberID in a session variable. Every page (which only allows members access), will redirect if this session variable does not exist. Now, if a member has successfully logged in, I need to display some personal information on subsequent pages (such as Username). Is it better to call the memberID session variable and query the member table on every page, retrieving the username and writing it to the page ... or, is it better to keep additional session variables (such as Username) right from the start (when logging in and setting the memberID Session variable), avoiding the need to query the database?

I hope this makes sense ...
Thanks,
Corneliuswell since the session variable can store all the data, and since it is present for the duration of the surfers log-in.... it seems a waste of time to hit the database each time the surfer browses a new page. It would just slow things up, and allow for an unnecessary amount of database calls.Dr Web,
thank you for your reply.

That's what I thought, only ... I read in some Microsoft publication (don't know if it was in MSDN Library, most likely), that accessing a Session variable also uses a lot of server overhead and I just wanted to know from people out there, which is actually better when applied (as opposed to in theory).
Now my question would be, is it better to store the entire row (from a recordset) in a single session variable and pull the required field out on the page, or should I create an individual session variable form each and every field I may need?

Thanks again,
Cornelius
 
Back
Top