Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 29th, 2004, 11:41 PM
Dominion Dominion is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 1 Dominion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Array Problems

Hi everyone, I seem to have a problem with my code. I get the following error when I try to run my script (reads from an 11 column CSV file):

Microsoft VBScript runtime (0x800A0009)
Subscript out of range: '[number: 155]'
/csvtest.asp, line 40

Here is my code:

Code:
<%
csv_to_read="CSVTest.csv"
set fso = createobject("scripting.filesystemobject")
set act = fso.opentextfile(server.mappath(csv_to_read))
'imported_text = act.readline
imported_text="Sku,Description,Finished,Category1,Category2,Categ  ory3,Royalty,New,NFrom,NTo,UPC"
imported_text = replace(imported_text,chr(13),",")
imported_text = replace(imported_text,chr(34),"")
split_text=split(imported_text,",")
num_imported=ubound(split_text)+1
total_imported_text = act.readall
total_imported_text = replace(total_imported_text,chr(13),",")
total_imported_text = replace(total_imported_text,chr(34),"")
total_split_text=split(total_imported_text,",")
total_num_imported=ubound(total_split_text)
function formattext(text)
formattext = replace(text,"**",",")
end function
%>
<%
dim count
count=0
for tablea = 0 to (total_num_imported/ (num_imported)-1)
%>
<%
for table = 0 to num_imported -1
%>
Insert into TableName(<%=imported_text%>) Values(<%=formattext(total_split_text(count))%>,<%=formattext(total_split_text(count+1))%>,<%=formattext(total_split_text(count+2))%>,<%=formattext(total_split_text(count+3))%>,<%=formattext(total_split_text(count+4))%>,<%=formattext(total_split_text(count+5))%>,<%=formattext(total_split_text(count+6))%>,<%=formattext(total_split_text(count+7))%>,<%=formattext(total_split_text(count+8))%>,<%=formattext(total_split_text(count+9))%>,<%=formattext(total_split_text(count+10))%>)<br><br>
<% 
count=count+11
next
%>
<% next%>



Thanks for the help!

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Array Problems


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway