Click here to Skip to main content
15,885,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In Access I can run this query:

SQL
SELECT T1.* INTO Temp FROM [Excel 12.0 xml;HDR=YES;IMEX=1;Database=E:\Book1.xlsx].[Sheet1$] AS T1

to import data from an XLSX file.

However if I run the same query using CDatabase::ExecuteSQL I get a "Could not find installable ISAM" error.

Why does one work and not the other?

What I have tried:

Googling the error message - but all the results seem to be focussed on connections through code (connection strings) rather than through SQL.
Posted
Updated 20-Apr-22 12:21pm
Comments
Richard MacCutchan 20-Apr-22 3:47am    
You have a secret error in your secret code. Seriously, how can anyone comment without seeing the actual code you try to use?

1 solution

Quote:
but all the results seem to be focussed on connections through code (connection strings) rather than through SQL.
Can I assume that CDatabase::ExecuteSQL is the MFC class? If so then before attempting to execute the SQL statement through that class you must have performed an Open. One of the parameters to the Open statement is lpszConnect
Quote:
Specifies a connection string. The connection string concatenates information, possibly including a data source name, a user ID valid on the data source, a user authentication string (password, if the data source requires one), and other information. The whole connection string must be prefixed by the string "ODBC;" (uppercase or lowercase). The "ODBC;" string is used to indicate that the connection is to an ODBC data source; this is for upward compatibility when future versions of the class library might support non-ODBC data sources.
It is that connection string that is incorrect - possibly targeting an earlier version of Office.
 
Share this answer
 
Comments
Maciej Los 21-Apr-22 12:07pm    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900