0

I am using .mdb database in ASP.NET MVC application.

I am inserting multiple rows within a for loop using transaction. In case of exception, transaction is rollbacked & disposed. But if I try to insert after an exception, I am getting OleDbException Could not update; currently locked. Database table is not opened in design mode.

But if I close and re-open visual studio, and re-run the app, then it works fine.

Any clue?

s.k.paul
  • 7,099
  • 28
  • 93
  • 168
  • 1
    Sounds like upon an exception being caught, the previous transaction is not being disposed properly and is therefore still trying to use the DB. – Alfie Goodacre Dec 12 '16 at 09:31
  • @AlfieGoodacre, Thanks. Your assumption is correct. I missed to dispose transaction somewhere. – s.k.paul Dec 12 '16 at 09:48
  • 1
    Show part of code which includes Access DB transaction/query (using `OleDbConnection`) in your question if necessary. I think you should close a database transaction even after an exception has triggered. – Tetsuya Yamamoto Dec 13 '16 at 02:40

0 Answers0