PDA

View Full Version : trapping values from a loop


robert475
02-18-2010, 12:38 PM
Hi

I have a table in a database with about 50 products.

On my asp page i have written a query to fetch the data from the table. The products are distinguished by productCode so the program will loop through the records until .EoF.

I can get these to display on screen fine but i want to know how can i trap each record that is displayed into a session variable?

e.g. if the query returns 5 records:
videoClipRs("Path") = session("1")
videoClipRs("Path") = session("2")
videoClipRs("Path") = session("3")
videoClipRs("Path") = session("4")
videoClipRs("Path") = session("5")

I hope this makes sense what i am saying.

Thanks for your help.

vinyl-junkie
02-18-2010, 12:41 PM
What problem are you trying to solve? There may be a better way of solving it than storing product codes in session variables.

robert475
02-18-2010, 02:46 PM
What problem are you trying to solve? There may be a better way of solving it than storing product codes in session variables.

I am trying to reproduce this:

http://javascript.internet.com/miscellaneous/image-swap-and-preload.html

I have got 4-5 product shots of each product and want to implement a image swap feature as opposed to loading the whole page, similar to this:

http://www.gap.com/browse/product.do?cid=31494&vid=1&pid=675323


My product images are displayed through the loop sequence.

Old Pedant
02-18-2010, 07:12 PM
Don't you have that backwards????


videoClipRs("Path") = session("1")
videoClipRs("Path") = session("2")
videoClipRs("Path") = session("3")
videoClipRs("Path") = session("4")
videoClipRs("Path") = session("5")

That *ASSIGNS* the values from session variables *TO* elements of a recordset. You would only do that in certain ADODB-based code to *update* the database.

If you mean "how do I copy record values from a recordset into session variables", it's much much much easier.

Session("Paths") = videoClipRs.GetRows()

Presto. You just converted the entire recordset into a 2D array and then stored that 2D array in a session variable.

At any point, then, you could do:

whatever = Session("Paths")( columnNumber, rowNumber )