Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics 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 March 25th, 2006, 02:52 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default help me please

Hello all
I have a problem with recorset.is there any one here can help me please???
I have 11 different recordsets.i want to use them in an array.is the code below correct?
a=array("rs",...."rsn")
for each elementArray in a

a(i).movefirst()
while not a(i).eof
'do some thing'
wend
next
but it gives me object required:rs error for the line that has a(i).movefirst()
rs1,..rsn are recordsets
would you please tell me where is the problem
thank you

 
Old May 1st, 2006, 06:33 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It looks to me that you have an array of strings, not recordsets.

Woody Z http://www.learntoprogramnow.com
 
Old May 1st, 2006, 07:01 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Yes woodyz is correct. Therefore:
;;;would you please tell me where is the problem
You can not moveNext in this nature. A bit about arrays:

There are two ways you can define an array in ASP. Lets look at examples for each:

Method 1:
Dim myArray
MyArray=Array("Jan","Feb","Mar","Apr","May","Jun", "Jul","Aug","Sep","Oct", "Nov","Dec")

Method 2:
Dim myArray(2)

myArray(0)="Jan"
myArray(1)="Feb"


In Method 1, we are defining the entire array in one line. This method is useful for arrays that have a specific use, like the example above that only stores a list of months.

In Method 2, we define values for each individual element on separate lines. This method can be used if you want to store elements from a record set as separate items of an array, or can be used in a loop to define values for each element,

This example may also be useful to you:

dim myArray,I
MyArray = Array("rs","abc","rsn")
For I = 0 to 2
   response.write Myarray(I) & "<br>"
Next

If you want to turn a record set into an array use:
dim arrayName
arrayName = rs.GetRows

This is a good way to code a page. After you have your record set and have placed it in an array yoiu can set your recorset = nothing, close your connection and then use the data with minimal use of server resources.

Wind is your friend
Matt









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