12 Replies Latest reply on Oct 12, 2010 9:42 PM by Tpaul

    Upload excel data into SQL DB using CFQUERY

    Tpaul Level 1

      I am using Excel 2007 and SQL 2005, but the folliwng code is not working and I am getting the message which I have set. Could you please help me out what changes to be made for my <cfquery>Tag?


      Cftry> 
      <CfQuery name= "MyXLQry" datasource="myXL">
      Select * from [FirstTab$]
      IN '#thisDirectory#\#newName#' 'EXCEL 5.0;'
      </cfquery>
      <cfcatch type="Database">
          <cfset message="This is not the correct Excel file as the FirstTab is not present.">
          <cflocation url="dsp_message.cfm?message=#message#" addtoken="No">
      </cfcatch>
      </cftry>


      I have set up "myXL" as ODBC Socket in CF Admin and using CF 7.0 (don't want to CFCs)

       

      Thanks