You mentioned that you were trying to track down a random timeout problem. I had the same thing, as a rule, when I did SELECT, which returned many rows. Two things:
Cnn.CursorLocation = ADODB.adUseServer
(Another option is adUseClient). I believe adUseServer gave me faster requests, which reduced the chance of timeouts. You do this before you open the connection, I suppose.
Cnn.CommandTimeout = 0
Also before open (), it says that you want an infinite timeout. I think the default timeout is something like 30 seconds, which is too short for some queries. CommandTimeout will be used for Recordset queries. If you use a Command object, it has its own CommandTimeout member, which does not seem to inherit from Connection (i.e. I installed it before executing the command).
Sorry if the syntax is not quite right, I cut from some C ++ code.
source share