All you are doing now is putting the csv file into a database record.  You need to do 
something like this...

<cfloop index="i" list="#rawfile# delimiters="#Chr(10)##Chr(13)#">
<cfset break = Find(",", i)>
        <cfset name=Left(i, break-1)>
        <cfset faxnumber=Right(i, Len(i)-break)>
<cfquery datasource="enews" name="Update">
    INSERT INTO Fax
    (Name, faxnumber)
    VALUES('#name#', '#faxnumber#')
</cfquery>
</cfloop>

On Jun 11, 2001 at 2:43 PM, you wrote...I need to upload a CSV file and enter its 
field values into a database.
> 
> I can read the file and output it
> 
> <cffile destination="e:\WebSites\KCHost\Fax" action="UPLOAD"
> nameconflict="overwrite" filefield="XFile">
> <cffile  action="READ" file="e:\WebSites\KCHost\Fax\#FILE.ServerFile#"
> variable="RawFile">
> 
> <cfquery datasource="enews" name="Update">
> INSERT INTO Fax
> (Name)
> VALUES('#RawFile#')
> </cfquery>
> 
> 
> This puts into one field. But how can Read each field
> 
> The fields would be Name, Faxnumber
> 
> 
> 
> Rick Eidson
> 
> 
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to