How to prevent 'query timeout expired'? (SQLNCLI11 error '80040e31') How to prevent 'query timeout expired'? (SQLNCLI11 error '80040e31') sql sql

How to prevent 'query timeout expired'? (SQLNCLI11 error '80040e31')


Turns out that the post (or rather the whole table) was locked by the very same connection that I tried to update the post with.

I had a opened record set of the post that was created by:

Set RecSet = Conn.Execute()

This type of recordset is supposed to be read-only and when I was using MS Access as database it did not lock anything. But apparently this type of record set did lock something on MS SQL Server 2012 because when I added these lines of code before executing the UPDATE SQL statement...

RecSet.CloseSet RecSet = Nothing

...everything worked just fine.

So bottom line is to be careful with opened record sets - even if they are read-only they could lock your table from updates.