troubleshooting Question

Upload data using CFQUERY with Excel 2007 and SQL 2005

Avatar of Tpaul_10
Tpaul_10Flag for United States of America asked on
ColdFusion Language
26 Comments3 Solutions635 ViewsLast Modified:
Experts,

I was using the following code to read the data from an excel(2000) sheet to SQL (2000) database and then have SQL Query to insert the data in to a table.

Now I am using Excel 2007 and SQL 2005, but the above 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?

Datasource has been set up and I am using CF 7.0 now.

Thanks
<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>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 3 Answers and 26 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 26 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros