After a number of hours of searching and banging my head against the wall I
found out how to get my teab delimited file to import into access and populate
teh table with the correct data. However I have 2 problems.
1. Line 1 of the txt file contains what used to be column names from excel. is
there a way to remove line 1 so it stops inserting column names into my
database?
2. Using code i'll put below, i get this error, and i am baffled.
Here is the error:
Invalid list index 17.
In function ListGetAt(list, index [, delimiters]), the value of index, 17, is
not a valid as the first argument (this list has 16 elements). Valid indexes
are in the range 1 through the number of elements in the list.
Here is my code.
<cfif isDefined('form.filename')>
<cffile action="upload" destination="#expandPath('.')#"
filefield="filename" nameconflict="overwrite">
<cffile action="read" file="#expandpath(cffile.ServerFile)#"
variable="fileData">
<cfloop index="record" list="#fileData#" delimiters="#chr(10)##chr(18)#">
<cfquery name="qryInsert" datasource="#APPLICATION.datasource#">
INSERT INTO ProfilerXLS (office, paid_date, rcpt_number, rcpt_year,
lastname, pri_ssn, product, prepared, transmited, totalfee, amtpaid, credit,
how_paid, deposits, creditdeps, difference, creddifference)
VALUES (
<cfqueryparam value="#listgetat(record,1,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,2,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,3,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,4,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,5,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,6,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,7,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,8,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,9,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,10,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,11,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,12,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,13,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,14,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,15,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,16,chr(9))#"
cfsqltype="cf_sql_longvarchar">,
<cfqueryparam value="#listgetat(record,17,chr(9))#"
cfsqltype="cf_sql_longvarchar">
)
</cfquery>
</cfloop>
Data inserted into the database!!
Any help would be great!
Thanks,
Steve
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:261628
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4