ADODB query timeout ADODB query timeout vba vba

ADODB query timeout


Not sure if you already got over the problem but I had the same issue.I'm doing it with Recordset.Open SQL_String, Connection.

And before that I just set the timeout property, not on the Recordset or Command but on the Connection object:

Connection.CommandTimeout = 0


from http://codingjourney.blogspot.com/2008/11/ado-connection-timeout-command-or.html

The Solution

You must also set the commandTimeout property on the ADODB.Command or ADODB.Recordset being used. Otherwise those objects will use the default time limit of 30 seconds because they do not inherit the time limit from the associated ADODB.Connection instance.

Example Using VBScript in ASP 3:

set con = createObject("ADODB.Connection")con.open connectionStringcon.commandTimeout = 60set command = createObject("ADODB.Command")command.activeConnection = concommand.commandType = adCmdTextcommand.commandText = sqlcommand.commandTimeout = 60command.executeresponse.write command.commandTimeout 'This is now 60 seconds.


For OLEDB do you not need to specify the timout on the connection :-

Provider=Microsoft.Access.OLEDB.10.0;Persist Security Info=False;Data Source=MyServer;Integrated Security=SSPI;Initial Catalog=MyDatabase;Data Provider=SQLOLEDB.1;Connect Timeout=30