Query Timeout Settings in Excel
new to the site I'd like to give it a shot and see if I can get any answers regarding SQL Querys in Excel.
Is there a way to handle if a Timeout occurs in Microsoft Excel (mostly 2007/2010 on Win XP/Vista/7)? As you know you can connect Excel to a Microsoft SQL Server and run your query via Excel. The only thing is that I don't seem to find any Timeout options for this. And for an example, if there is a bad query, this might lock other tables in the SQL Server (2005) database.
I'm not looking for a script. It's more like settings I need and if possible I would like to add these Timeout settings to a specific Windows user account. Settings in either SQL Server 2005 or in Microsoft Excel 2007/2010.开发者_开发百科
Best regards /Henrik
Use the CommandTimeout property
Dim objCommand As ADODB.Command
Set objCommand = New ADODB.Command
objCommand.CommandTimeout = 99 '
objCommand.ActiveConnection = cnConn
objCommand.CommandText = "DELETE Users WHERE IdLevel < 98"
objCommand.Execute
精彩评论