» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > ASP forums and Tips

ASP forums and Tips Talk about ASP Scripting. .net and Cold Fusion as well.

Reply
 
Thread Tools Display Modes
  #1  
Old 12-08-2005, 06:55 AM
johny johny is offline
OSP Starters
 
Join Date: Dec 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
johny is on a distinguished road
Default Microsoft VBScript runtime error (0x800A0009)

I am new to ASP and I am trying to use a dynamic array to store the ids from a mysql query. However, as I do not know how many rows are going to be picked out of the database I do not know the length of the array therefore I require a dynamic array. Within the loop that gets the content from the query I have a variable 'i' which increments and as that increments it should also increase the size of the array. However, I get an error could someone please help me. Thanks in advance



the code is as follows:

dim p_info()
dim i
i= 0
'select statement
SelectProperty ="SELECT * from propertyinfo where P_area='Aston';"
set objrec = objConn.Execute(SelectProperty)
Redim p_info(1)


do while not objrec.eof
response.write(objrec("P_num"))
p_info(i) = (objrec("P_num"))
Redim PRESERVE p_info(i)
i= i + 1
Response.Write ("& -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 12-08-2005, 06:57 AM
Deur Deur is offline
OSP Starters
 
Join Date: Dec 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Deur is on a distinguished road
Default Solution

Rather than looping through the recordset populating the array why not use getrows to populate the array, that way it will create an array to the required size no matter how many records are returned. e.g.

Code:

'build recordset
SelectProperty ="SELECT * from propertyinfo where P_area='Aston';"
set objrec = objConn.Execute(SelectProperty)
'check recordset is not empty
if not (objrec.eof or objrec.bof)
'get number of records
p_info_count = objrec.recordcount

'build array
p_info = obrec.getrows()
end if
'close recordset
objrec.close
set objrec = nothing -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VBScript runtime error bond ASP forums and Tips 1 08-26-2006 02:26 PM
"Microsoft VBScript runtime (0x800A0046) Permission denied" edgy ASP forums and Tips 2 08-17-2006 01:56 PM
Microsoft Office Live Beta Launched outsourcingplans Web Hosting Industry 0 02-19-2006 06:09 PM
Hosting.com Attains Microsoft Gold Partner Status outsourcingplans Web Hosting Industry 0 02-19-2006 06:09 PM
Microsoft Launches Hosting Partner Program outsourcingplans Web Hosting News 0 12-09-2005 04:39 PM


All times are GMT. The time now is 02:33 AM.