Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using C#,asp.net 2.0,server 2005 and visual studio 2005
Can anybody help with the following error:



i have a gridview with edit and delete button... when i select an item from dropdownlist ,it will load gridview with database values.

when i edit the row in a grid view and press update button,,it takes some time and later it is giving error like :

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.


please help me.
Thanks in Advance.
Regards,
Karan
Posted
Updated 10-Jun-11 1:33am
v2

This error occurs when a database query or stored procedure is not able to complete execution before a pre-set timeout period expires.

Do one thing

Increase the amount of time that ASP.NET waits for the database query to run before throwing an exception. Programmatically set the CommandTimeout property in the IDbCommand object in a code customization in your application. IDbCommand is a .NET Framework object. CommandTimeout specifies the amount of time in seconds that .NET waits for the database query command to execute. Set that value high enough to exceed the amount of time required to execute your query or database stored procedure. You may need to adjust this timeout parameter on an application-by-application basis.

C#:

System.Data.IDbCommand.CommandTimeout = 50;


secondly,

Increase the amount of time that your database driver waits on your connection. This is different from the IDbCommand.CommandTimeout property. Both must be set properly for your query or stored procedure to run.


For more info visit[^]

Hope it helps ...... :)
 
Share this answer
 
Comments
karan joshua 10-Jun-11 7:58am    
i am using sql server 2005,
i tried but not working still,,

i set cmdTToAdd.CommandTimeout = 6000;
 
Share this answer
 
Comments
thatraja 10-Jun-11 8:03am    
what about other cases? check the all possible situations in my answer link.
thatraja 10-Jun-11 8:14am    
Probably you need to share the code, so include that in your question.

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