devxlogo

Passing Recordset Object Between ASP Pages

Passing Recordset Object Between ASP Pages

Question:

I have an ASP called ‘default.asp’ that creates a recordset object called ‘objRS’ via ODBC. When a certain set of conditions is met, I linked it to another ASP page called ‘seenbuy.asp’ that needs to perform some actions based on ‘objRS’.

‘Seenbuy.asp’ does not know what ‘objRS’ is because that variable is declared private within ‘default.asp’. I know that I can pass variables with query strings, but can I pass this object ‘objRS’ to ‘seenbuy.asp’ using a query string? Or should I simply declare ‘objRS’ as a public variable (though this doesn’t seem like the best solution to me due to possible memory issues later as public variables eat memory)?

Answer:
One ASP page cannot see another page’s variables, as you mentioned. I would suggest you perform the query, saving the recordset to a filename. I would pass that filename to the next ASP page, and then reload the recordset using the passed filename. For any sizable query this will be a major improvement.

See also  How to Avoid Money Transfer Scams  
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist