Today, I have encountered this problem, Google, I didn't expect GHJ 1976 to have written blog. Oh, it is easy to make mistakes.
http://blog.joycode.com/ghj/archive/2004/06/15/24612.aspx
Reposted:
If you are using the database connection class is the Data Access Application Blocks "SQLHELPER" or SQLClient Class, you may touch the overtime exception below when you perform a tethered SQL operation.
---------------------------
-------------------------- Timeout Expired. The Timeout Period Elapsed Prior To Completion of the Or The Server IS NOT RESPONDING .--- ------------------------ OK ------------------------- -
You will say that I have set up the connection string in the connection string, and the timeout connection in the database is also a big value. For 30 seconds, still timeout? ?
This is because: Your settings are not a problem, you confuse the difference between SQLCommand.commandTimeout and SqlConnection.ConnectionTimeout. The timeout in your connection string is just the value of the set SQLConnection.ConnectionTimeout, not the value of the set sqlcommand.commandtimeout. There is no set of SQLCommandTimeout in SQLHELPER. Need you to set it yourself.
Here are two comparisons:
SQLCOMMAND.COMMANDTIMEOUT Gets or sets the wait time before the execution command is terminated and generates an error. Waiting for the time (in seconds) of the command. The default is 30 seconds.
SqlConnection.ConnectionTimeOut Get the time waiting for the attempt and generate an error before attempting to establish a connection. Wait for a connection to open time (in seconds). The default is 15 seconds.
Some more detailed descriptions of this issue: http://www.eggheadcafe.com/printsearchContent.asp? Linkid = 357
This problem can be considered when SQLHELPER is designed. Sqlcommand.commandTimeout's default is 30. For most programs I wrote, this value is sufficient. So I have never found this problem with SQLHELPER. Today, I found this problem that SQLHELPER exists when I generated a long post (nearly 4,000 replies) on a changing machine.