How can I stop time out error for executing SQL query in ASP.Net? I researched in Google but I couldn't solve my problem correctly.
Asked
Active
Viewed 9,542 times
2 Answers
2
I think your problem is about CommandTimeOut.The time (in seconds) to wait for the command to execute. The default is 30 seconds. Here is full example. Otherwise, you should set the ConnectionTimeOut in your database connection string. Something like that
<add key="ConnString2" value="Provider=SQLOLEDB;User Id=sa;PASSWORD=1;
SERVER=BlurBlur;database=BlurBlur;Connect Timeout=60;"/>
If you use the UpdatePanel, set the AsyncPostBackTimeout.
<asp:ScriptManager ID="ScriptManager1" runat="server"
AsyncPostBackTimeout ="360000"></asp:ScriptManager>
to be more sure
<httpRuntime executionTimeout="360000"/>

kst
- 1,498
- 3
- 19
- 34
-
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerTimeoutException: The server request timed out. This is the error Message – Sayanthan Oct 12 '11 at 08:45
0
Please consider you have 2 timeout to deal with when you access database via ADO.net
ConnectionTimeout
set in connection string: it's the time in seconds asp.net will time out in opening a connection
and
CommandTimeout
es: SqlCommand cmd = new SqlCommand();
cmd.CommandTimeout = .....;
it's the time in seconds the sql command will timeout.
Stefano

Stefano.net
- 1,078
- 1
- 11
- 25