ERROR [HY000] [Microsoft][ODBC Excel Driver] Operation must use an updateable query
When trying to add a record to an Excel spreadsheet via ODBC, the following exception is thrown:
System.Data.Odbc.OdbcException: ERROR [HY000] [Microsoft][ODBC Excel Driver] Operation must use an updateable query.
Possible Causes and Remedies
- The ASP.NET worker process does not have permission to update the
- Check that the spreadsheet file does not have the read-only file attribute set.
- Ensure that the ASP.NET worker process has full control over the Excel file that it is trying to update. (Using Windows Explorer open the Folder properties and on the Security tab, grant "Full Control" to the ASP.NET machine account.)
- Check that the database connection is not set to read-only.
- Add "Readonly=0;" to the ODBC connection string.
- Be aware that unless you specify the parameter explicitly it appears to default to readonly.
These notes have been tested within Microsoft Visual Studio .NET 2005 for .NET 2 running under Windows XP Professional, and may apply to other versions as well.
About the author: Brian Cryer is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.