Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. 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 Professional 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 October 10th, 2003, 04:15 PM
Registered User
 
Join Date: Oct 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default How Do I Reuse data from a RecordSet?

I need help on how to reuse data stored in a recordset on a form. This is the setup:

Call the file with the form f1.asp. The form in f1.asp has a select element, a submit button, and various input:text elements. When I click the submit button, I handle the event in a JavaScript function where I set the form's action to the url of another asp page, call it f2.asp. In f2.asp, I assemble a query to select from the database, using some input from f1.asp in the where clause. I set a Session variable to this query string, and I set another Session variable to indicate what action to take when transferring back to f1.asp.

Now we are transferred back to f1.asp, and the Session variable set in f2.asp is checked and the value of it indicates we want to populate the select element. The other Session variable with the query is used by a recordset and the query is executed. Next loop through the recordset and populate the select element, and also save off the same data (and some additional data) in an array so that I have the data saved and can close the recordset.

Now we have a populated select element. The idea now is to click on an item in the select element, then display other data that is associated with the selected item, i.e. I click on item "Tim Jones" in the select element, and populate the input:text elements on the form with other data for "Tim Jones". Assume this is the data that was saved in the array I discussed earlier.

The dilemma is, the recordset code, and the code where I initialize the array was all in <% %> tags. When I handle the onclick event for the select element (this is dynamic html – not asp related), I don’t seem to be able to use asp tags, in other words, I can't seem to have access to the array with the data I need to populate the input:text elements.

Does anyone have experience doing this kind of thing?







 
Old October 14th, 2003, 11:25 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You are going to have to write up something to basically translate all your data from server-side into something client-side. Not knowing your table structure makes it hard to recommend the best solution, but I can suggest that you create some client-side javascript arrays to hold a snapshot of your data. Depending on your data structure you might be able to bury it all inside of a single multi-dimensionaly array, or draw up several arrays (one for each table). If you have multiple arrays, you'll need some method to search or filter the data in them. If you did it with a single array with multiple dimensions, then you could access it from a hierarchical perspective.

myDataArray[<index1>][<index2>]...

This I would think would be a little more difficult to set up initially, but much easier to deal with to retrieve the data. It saves you from writing your own search/find code.

Once you have it all client-side then you can do what you need with it from your select dropdowns. For the given select index, dig out the field data and populate your text inputs.

Peter
 
Old October 21st, 2003, 05:30 AM
Registered User
 
Join Date: Oct 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
I am getting this error ...
Error Type:
CreateRecordset (0x80041820)
Service is not running.

What may be the problem ? & what can be the solution ?
This error I am getting when I am executing my search code written in .asp... the OS I am using is Windows 2000.

Regards,
Samir







Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Data from Recordset vbprowanabe Pro Visual Basic 2005 1 January 17th, 2008 01:08 AM
How to bind data from a recordset to a combobox? wayne62682 Access VBA 6 April 2nd, 2006 08:45 PM
Reuse the recordset object eapsokha Classic ASP Professional 4 February 27th, 2004 12:05 AM
Structuring Recordset data brendonsmith XSLT 2 January 19th, 2004 07:14 PM





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