Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
You can try this way...convert it to array and then import to db. Refer http://www.cflib.org/udf/CSVtoArray
Copy link to clipboard
Copied
Take the try/catch off and tell us the actual error...
To fix something, first one needs to know what the problem is.
--
Adam
Copy link to clipboard
Copied
Took out all the <cftry> and <cfcatch>.
Getting HTTP 500 Internal Server rerror
But the code works well with .XLS and getting error for .xlsx
is there any problem with OBDC socket or dsn?
Thanks
Copy link to clipboard
Copied
Dunno mate, sorry.
Are your ODBC drivers all up to date? Like I mean the Windows ones, not the CF ones.
Have you looked @ using POI instead of ODBC?
--
Adam
Copy link to clipboard
Copied
Are your ODBC drivers all up to date? Like I mean the
Windows ones, not the CF ones.
I am pretty sure you would need to update your drivers. IIRC the old Jet 4 drivers do not support Office 2007 format.
Message was edited by: -==cfSearching==-
Copy link to clipboard
Copied
P.S. that 500 error could be another layer of obscufication masking the real errors, IF you have not turned on the Enable Robust Exception Information option in the ColdFusion administrator of ColdFusion.
Copy link to clipboard
Copied
ODBC drivers all up to date and where can I find *Enable Robust Exception Information*?
I don't see it under Debugging &logging Settings
Thanks
Copy link to clipboard
Copied
Debugging & Logging > Debug Output Settings
Copy link to clipboard
Copied
you'll also want to turn off friendly error messages in your browser (instructions vary depending on which one you're using)
Copy link to clipboard
Copied
I have the same issue as you......
Copy link to clipboard
Copied
Did you update your drivers?
Copy link to clipboard
Copied
It worked with the following.
1) Used 'EXCEL 12.0' in my query
2) Updated the drives for Excel 2007
Thanks