posted 12/9/2011 by Vivek Thakur
The default SqlCommand timeout is 30 seconds, so you might get this error while executing a lengthy Sql operation (like creating a DB and its schema via C# code):
Error : Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
In order to fix this, just increase the command time out as follows:
myCommand.CommandTimeout = 120; // 2 min
(where mycommand is a SqlCommand object)
What kind of email newsletter would you prefer to receive from CodeAsp.Net?18