Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maintaining Information Across ASP Pages 1

Status
Not open for further replies.

yogi77

Programmer
Oct 12, 2001
25
GB
Hi,

(Great site by the way, just came across it and it looks like it will become my second home from now on)

I am relatively new to ASP and the world of web programming so please excuse me if I am asking obvious questions.

(Using ASP3.0, IIS5, VBScript, VB6 Components)

I am querying a SQL7 DB based on a search value submitted by my users (text box), the resultant data (if any) from the query is then populated into a <table> on the same ASP. The challenge lies in trying to remember each previous selection, after populating the <table> (the user usually performs at least 2 or 3 searches).

What I am doing is this;

Rendering first ASP page, which contains IFRAME with second ASP as src.

The second ASP page does all the DB search and return part. However I want to keep the returned data in the <table> from search 1, 2 etc even after searching for a 3rd or 4th part. I want the <table> to grow with each query. At the moment the <table> is being re-created with each submit of the search and hence only being left with the most recent search results from the DB.

Should I be using an array, if so where should I store it? Cookies? Session variable?

Any help or direction would be greatly appreciated.

Thanks in advance,

Yogi
(ASP is like running thru mud just now)
 
If you really want to persist the data, you could use Session variables... but if your site gets a lot of hits, the memory usage would be real high, especially if their respective tables grow to be real large.

I would suggest creating a storage type table in SQL, keeping the UID, Date/Time, and whatever fields you need in there. You would have to query the DB for each page, but I think that it would be better than creating all the session variables you might need... I know that this table can be potentially huge as well, so you need to make sure you flush out old entries every couple days or so (depending on your specifications), so create a job to do it for you.

hth leo

------------
Leo Mendoza
lmendoza@students.depaul.edu
 
Thank you Leo, your help was appreciated. I have now implemented it this way and it works a treat!!!

I really don't understand the ramifications fully yet of untilizing session vars and cookies - hopefully soon though.

Thanks again

Yogi.
 
Yogi -

Session vars are OK as long as:
[tab]The data is relatively small
[tab]You aren't using a web farm
[tab]You don't have a ton of users

If any of the above is true, you need to find another way to store a visitor's session info, and this usually results in a cookie, a database entry, or both. What we did at my last company was to use a cookie to store an encrypted session identifier, with the cookie set to time-out after 20 minutes. The session ID was the primary key into a session table in the database. Every so often we'd have a process delete all the orphaned session entries in the table.

Chip H.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top