Tuesday, March 2, 2004
For months I've been stuck with a dilemma. I'm running some stored procedures that usually take 5-10 seconds to run. However, if SQL Server slows down, whether because of high user load or anything else, sometimes execution can take longer. I'm getting my data using the Recordset object, mainly so I can get a dynamic cursor, and move forwards and backwards through the data, building tables out of rowsets.
What has always been the problem is that the ADO Recordset object doesn't provide a CommandTimout property; only the Command and Connection objects do. Today I discovered that the OLE DB Provider for SQL Server adds several properties to the Recordset object (as well as others), including, lo-and-behold, a "Command Time Out" property. Hurrah! Now I can bump the timout past the 30sec default enough to accomodate peaks in demand with objRecordset.Properties("Command Time Out") = [seconds] .
Very nice.0 Comments