2 Replies - 14699 Views - Last Post: 08 January 2007 - 10:04 PM Rate Topic: -----

#1 meenaksh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 29-December 06

read a tab delimited file and store it in a database using cf

Posted 08 January 2007 - 03:59 AM

hi all,

read a tab delimited file and store it in a database using cf

Thanks,
meenaksh
Is This A Good Question/Topic? 0
  • +

Replies To: read a tab delimited file and store it in a database using cf

#2 psykoprogrammer  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 72
  • Joined: 09-October 06

Re: read a tab delimited file and store it in a database using cf

Posted 08 January 2007 - 07:06 AM

Let us first start out with what is wrong here. Per forum rules you must demonstrate that you have put actual coding effort into your project with your own code.

So please, take a crack at it.

Tips:
1. You'll need CFFILE
2. For reading a line you can possibly treat each tab-delimited column as a list item, therefore the list commands like ListGetAt and ListLen can apply.

Good luck.
Was This Post Helpful? 0
  • +
  • -

#3 meenaksh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 29-December 06

Re: read a tab delimited file and store it in a database using cf

Posted 08 January 2007 - 10:04 PM

View Postpsykoprogrammer, on 8 Jan, 2007 - 07:06 AM, said:

Let us first start out with what is wrong here. Per forum rules you must demonstrate that you have put actual coding effort into your project with your own code.

So please, take a crack at it.

Tips:
1. You'll need CFFILE
2. For reading a line you can possibly treat each tab-delimited column as a list item, therefore the list commands like ListGetAt and ListLen can apply.

Good luck.


hi

i did that

<cfset filepath = "C:\CFusionMX\wwwroot\SalesCustomer.txt">

<cffile action="read" file="#filepath#" variable="fileData">

<cfloop index="record" list="#fileData#" delimiters="#chr(10)#,#chr(9)#">

<cfquery name="Q_insert" datasource="#dsn#">
insert into Clients (ClientName) values ('#record#')
</cfquery>

<cfquery name="Q_select" datasource="#dsn#">
select * from Clients
</cfquery>

</cfloop


thanks,
meenaksh
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1