p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Professional (http://p2p.wrox.com/forumdisplay.php?f=63)
-   -   How Do I Reuse data from a RecordSet? (http://p2p.wrox.com/showthread.php?t=4843)

steve456 October 10th, 2003 04:15 PM

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?

planoie October 14th, 2003 11:25 AM

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.


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.


samirn October 21st, 2003 05:30 AM

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.


All times are GMT -4. The time now is 08:22 PM.

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