Hi everybody I am new to this list and looking forward to learning from your
posts.

I am new to ColdFusion so need lots of help.   I would like to be able to
update/overwrite a table in a remote Access data base from a local csv or
excel file.  It has been suggested that I use WDDX, does anyone have any
idea how this works.

I also have these two scripts which use an array but I have been unable to
make them work.   Can anyone help?
----------------------------------------------------------------------------
---
<cffile action="read" file="c:\your\path\to\file.txt"
variable="theVariable">
<cfset delim=chr(13)>
<cfset delim2=",">
<cfloop index="x" from="1" to="#listlen(theVariable,delim)#">
     <cfset value1 = listgetat(theVariable,x,delim2)>
     <cfset value2 = listgetat(theVariable,(x + 1),delim2)>
     <cfset value3 = listgetat(theVariable,(x + 2),delim2)>
     <cfquery datasource="myDSN">
          insert into myTable(value1,value2,value3)
          values(#value1#,'#value2#',#value3#)
     </cfquery>
</cfloop>

----------------------------------------------------------------------------
-------







      <!-- Loading CSV file into array -->
      <cfoutput>
      <cffile action="read" file="#file#" variable="csv">
      <cfset #csv# = #Replace(csv,chr(13),"#delim#","all")#>
      <cfset #csv# = #Replace(csv,chr(10),"","all")#>
      <cfset csvdata = ArrayNew(2)>
      <cfset arraysize = 1>
      <cfset counter = #Find("#delim#",#csv#,1)#>
      <cfloop condition="#counter# GT 0">
              <cfloop index="y" from = "1" to = "#fieldnum#">
                      <cfif #counter# EQ 1>
                              <cfset csvdata[#arraysize#][#y#] = "">
                      <cfelseif #counter# GT 1>
                              <cfset csvdata[#arraysize#][#y#] =
#Left(csv,(counter-1))#>
                      </cfif>
                      <cfif #Len(csv)# GT 0>
                              <cfset #csv# = #RemoveChars(csv,1,counter)#>
                      </cfif>
                      <cfset counter = #Find("#delim#",csv,1)#>
              </cfloop>
              <cfset csvdata[#arraysize#][#y#] = #csv#>
              <cfset arraysize = arraysize + 1>
      </cfloop>
      <cfset arraysize = arraysize - 1>
      </cfoutput>



------------------------------------------------------------------------


------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to