Click here to Skip to main content
16,021,125 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
Server Error in '/' Application.
--------------------------------------------------------------------------------

Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

Source Error:


Line 243:            {
Line 244:                PrepareCommand(cmd, connection, null, cmdType, cmdText, commandParameters);
Line 245:                object val = cmd.ExecuteScalar();
Line 246:                cmd.Parameters.Clear();
Line 247:                return val;
Posted
Updated 12-May-11 22:53pm
v2

The cmd timed out because whatever you executed on the SQL Server (stored procedure, SQL statement etc.) took to long to finish. Set the SqlCommand.CommandTimeout to something more appropriate or even to 0 which means there will be no timeout. Read here: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout%28v=vs.71%29.aspx[^].

I strongly suggest though that you analyze you SQL as long execution times can be an indicator that something is not quite right with your SQL or with you data model.

Best Regards,

-MRB
 
Share this answer
 
v2
Comments
Ankur\m/ 13-May-11 6:33am    
Good answer, 5!
Manfred Rudolf Bihy 13-May-11 7:04am    
Thanks Ankur!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900