Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 19th, 2004, 07:23 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Temporary Session Recordset

I have been trying to create a temporary recordset and store it to the Session object (not linking to a database) so I can use this for a Shopping Cart.
So if the customer closes the website then the cart is lost as its stored in the db

I was using something think:-

Code:
Dim rsCart
Set rsCart = Server.CreateObject("ADODB.Recordset")
rsCart.Fields.Append "Session ID", adText
rsCart.Fields.Append "Product ID", adText
rsCart.Fields.Append "Quantity", adText
Set Session("Cart") = rsCart

Session("Cart").AddNew()
Session("Cart")("Session ID") = Session.SessionID
Session("Cart")("Prodcut ID") = Request.Form("Product ID")
Session("Cart")("Quantity") = Request.Form("Quantity")
Session("Cart").Update()
This seems to work but when I try to display the Cart details I get an error saying the recordset is not open

I know it can be done as I've seen an example somewhere but cant find it.

Does anyone have any examples like this? I know I could do all this using a global.asa file but I want to use the Session Object instead.

Any help would be gratefull.

 
Old August 19th, 2004, 10:20 PM
Authorized User
 
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

have you opened the Connection Object?
Connection have to be open as long as you want to access Recordset.

 
Old August 20th, 2004, 04:03 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

after you append the fields, call the Open method of the recordset





Similar Threads
Thread Thread Starter Forum Replies Last Post
Temporary Tables Challenge! PCNHSL PHP How-To 1 November 8th, 2007 09:42 AM
How to create a Temporary Table fdtoo SQL Server 2000 0 April 11th, 2006 08:38 PM
Temporary tables eadred ADO.NET 4 August 8th, 2005 12:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.