Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old March 9th, 2006, 08:29 AM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Pravin kumar
Default Dynamic generation of ADO recordset

Hey friends, i require a solution.
i require to generate recordset dynamically, in one of my application.
for example:

<%

For i=1 to 5
  objRs = "Rs" & i
  Set objRs = Server.CreateObject("ADODB.Recordset")
   ..........
   .........
   code using recordset.
  Set objRs = Nothing
Next
%>

How can this be possible ?
I dont want to create 5 different ADO Recordset.

Please Help me out friends..



  #2 (permalink)  
Old March 10th, 2006, 05:25 AM
Authorized User
 
Join Date: Mar 2006
Location: Aberdeen, Scotland, United Kingdom.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Pravin,

I think I have something for you, if I understand your problem right. The Execute statement. Check it out at:

http://msdn.microsoft.com/library/de...1136f2df81.asp

For i=1 to 5
   str = "Set objRs" & i & " = Server.CreateObject(" & chr(34) & "ADODB.Recordset" & chr(34) & ")"

   Execute str

....

This will create objRs1 through objRs5.

Not sure why you would want to do something like this, but in any case I think your question was about assigning to a variable name created dynamically.

Cheers,

Joel
  #3 (permalink)  
Old March 12th, 2006, 07:41 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;Not sure why you would want to do something like this
I can think of a reason or two (a heirachial menu, generating bar graphs on the fly)

;;I think your question was about assigning to a variable name created dynamically.
Yes, this is how I read it also.

mmmmmmm I have tryed to dynamicly name a record set and failed. I dont believe its possible with classic ASP. The post is here somwhere I will try and find it for you. There was allot of input from senior members, a solution was not found. i am very interested in seeing some code that works if anybody has managed to do it.

Wind is your friend
Matt
  #4 (permalink)  
Old March 12th, 2006, 07:50 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Ok I found it:

http://p2p.wrox.com/topic.asp?TOPIC_...ecord,set,name

FYI: This post has had input from the most senior and IMO Mr ASP

BTW: Next time you have a problem try and search for it on the forum before posting, there is a good chance the question has been asked and answered (like this one) This is why its important to logically name your posts. if you search for 'dynamicly name a record set' you would have found it

HTH

Wind is your friend
Matt


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic PDF Generation sandyg Classic ASP Components 12 June 15th, 2008 03:51 AM
Clone DAO Recordset into ADO Recordset kamrans74 VB How-To 0 March 6th, 2007 11:57 AM
Dynamic PDF Document Generation nialljpmurphy J2EE 4 March 27th, 2006 07:13 PM
Dynamic Button Generation LouMattera BOOK: Professional C#, 2nd and 3rd Editions 2 March 4th, 2005 04:26 PM
Convert ADO recordset to DAO recordset andrew_taft Access 1 May 5th, 2004 02:31 PM





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