2008-01-07

'Operation must use an updateable Query' OleDbException when using ADO with Excel files

When I was trying to run an insert query on an Excel database with ADO the following exception occured:

System.Data.OleDb.OleDbException: Operation must use an updateable query.

This means that the database is read-only, no records can be inserted.

Besides checking the permissions to your Excel file verify if the Extended Properties of the connection string contains the IMEX=1 expression. If yes, remove it. I dunno what it does but removing was the solution to my problem.

9 comments:

Anonymous said...

Thanks. this is what I was looking for. I removed IMEX=1 and it worked!

Thanks!

Anonymous said...

You saved our day! Thanks a lot!

Unknown said...

yeah removing IMX=1 worked for me.

Anonymous said...

Thanks a Lot :) ....
great....

Anonymous said...

thanks alot, pheallll.

Anonymous said...

its not working but i try this
IMEX=0
its working well

thnx for idea !!!!

Anonymous said...

Glad I ran across this post. Can't believe it's not documented elsewhere. THANKS!

Anonymous said...

Worked a treat. Thanks heaps!

Unknown said...

removing IMEX=1 worked for me, now i am able to update the excel - thanks