Click here to Skip to main content
11,641,971 members (63,389 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET SQL SQL-Server , +
I have an issue regarding execution of Stored procedure.

Actually, I have a stored procedure for databases backup in which I have implemented Cursors for each database to be backed up in that server. For execution of database backup, I have to just pass a parameter in that SP i.e. Folder path in which backup can be taken.

Now, when I pass the folder path from the ASP.Net web page, it takes backup of few databases while running almost for 30-45 secs then it gives error 'Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.'.

Secondly, I execute same procedure from query window of SQL Server passing same file path as parameter, it runs successfully without any error.

Please give me suggestions about this issue.
Posted 7-May-12 2:30am
Mantu Singh at 7-May-12 8:33am
Pls post code where you got error.......!
ryanb31 at 7-May-12 8:35am
How long does it take to run in the query window?
B Birajdar at 7-May-12 9:52am
Use SQL server profiler to check whats happening during execution
losmac at 8-May-12 9:05am
[EDIT]Moved from answer[/EDIT]
Firstly, Thanks to all for valuable suggestions.
Solution is that I have increased SqlCommand CommandTimeOut. Now it's working fine.
Ashish Naval
losmac at 8-May-12 9:23am
Dear Ashish Naval,
A good practice is to mark your question as "solved" and to rate any valuable solutions.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

try this :

SqlCommand.Timeout = 1000;

try changing your time out values for your command object depending upon the requirements. But this is not a good idea to rely on timeout. rather change your SP.
digimanus at 7-May-12 9:56am
It is indeed the TimeOut that is working against him. If he sets it to 0 it runs forever unless the call is finished.
losmac at 8-May-12 9:24am
Good answer, my 5!
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You can set this value in web.config. For example, to change the timeout for one specific page:

<location path="somefile.aspx">
                <httpRuntime executionTimeout="180"/>

See for more details.

Hope that helps.
losmac at 8-May-12 9:23am
Good answer, my 5!

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

  Print Answers RSS
0 Mika Wendelius 460
1 DamithSL 353
2 OriginalGriff 315
3 Sergey Alexandrovich Kryukov 179
4 Afzaal Ahmad Zeeshan 169

Advertise | Privacy | Mobile
Web01 | 2.8.150731.1 | Last Updated 8 May 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100