I have an application that generates queries dinamicaly and some of them are huge. I'd like to set a time limit for the queries.
I'm using ADO recordsets to run the queries in SQL 7. I've tried to set the CommandTimeout property for the connection i use in the Recordset.Open Method, but it didn't work.
Here is my test:
Set con = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
con.CommandTimeout = 5
con.CursorLocation = adUseClient
con.Open "Provider=SQLOLEDB.1;Password=*****;Persist Security Info=True;User ID=USR;Initial Catalog=DB;Data Source=Server"
rs.Open "select * from table", con, adOpenStatic, adLockReadOnly
The query runs for several seconds, even if i have set the CommandTimeout to 5 seconds.