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)