Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 January 31st, 2005, 03:56 AM
Authorized User
 
Join Date: Dec 2004
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Array Problem

Hi,

Does anyone have any idea how to create an array so that I can write the recordsets into the textfile in a loop. How do I declare the array such that I write only 6 recordsets from the access database into textfiles instead of 8? Meaning I opt out 2 tables to export to textfiles.

Pls help! Thanks!



 
Old January 31st, 2005, 07:48 AM
Authorized User
 
Join Date: Aug 2004
Location: Calicut, Kerala, India.
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I suppose you are asking about dynamic array.

While defining array dont priovide the size.
ie,
Dim arr_var()

Then in the while loop just use redim
ie
ReDim preserve arr_var(i_count)

Where preserve is the keyword to keep the array elements as it is.
and i_count be your dynamic size.
The loop may look like this.

Dim arr_var()
Dim i_count
i_count = 1
.........
.....
While not rs.eof
  Redim preserve arr_var(i_count)
  arr_var(i_count)= rs(0)
  i_count = i_count + 1
  rs.movenext
wend


Hope this will help you.:)




Shibu Narayanan
Software Associates
 
Old February 1st, 2005, 05:29 AM
Authorized User
 
Join Date: Dec 2004
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Shibu!

 
Old February 1st, 2005, 10:42 PM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Shibu,

How can I execute that piece of code in a function and return the entire array?

I'd like to create a function that retrieves data, loads it into an array and then returns that array? How is this accomplished in ASP?

Thanks!

 
Old February 2nd, 2005, 12:42 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

There is a very simple method.

let rst be the name of the record set used to fetch data and arr be the name of array.

arr=rst.GetRows()

will fill the array with whatever records fetched by rst. It will be a two dimensional array.The first script identifies the field and second one the record number.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Array Problem...Can anyone help?? :( Shuchik Classic ASP Basics 1 September 25th, 2007 05:21 AM
Array problem Ivanchan Excel VBA 2 July 24th, 2007 08:28 PM
problem in getting the value of an array knightneo Beginning PHP 0 December 4th, 2006 10:23 PM
Array Problem monika.vasvani ASP.NET 1.0 and 1.1 Professional 3 September 13th, 2006 05:56 AM
Array problem NEO1976 Javascript 0 August 3rd, 2006 03:55 AM





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