Click here to Skip to main content
Sign Up to vote bad
good
See more: ASP.NETSQLSQL-Server, +
Hi,
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:30

Comments
Mantu Singh - 7 May '12 - 8:33
Pls post code where you got error.......!
ryanb31 - 7 May '12 - 8:35
How long does it take to run in the query window?
B Birajdar - 7 May '12 - 9:52
Use SQL server profiler to check whats happening during execution
losmac - 8 May '12 - 9:05
[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 - 8 May '12 - 9:23
Dear Ashish Naval, A good practice is to mark your question as "solved" and to rate any valuable solutions.

2 solutions

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.
  Permalink  
Comments
digimanus - 7 May '12 - 9:56
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 - 8 May '12 - 9:24
Good answer, my 5!
You can set this value in web.config. For example, to change the timeout for one specific page:
 
<location path="somefile.aspx">
        <system.web>
                <httpRuntime executionTimeout="180"/>
        </system.web>
</location>
 
See http://msdn2.microsoft.com/en-us/library/e1f13641.aspx for more details.
 
Hope that helps.
  Permalink  
Comments
losmac - 8 May '12 - 9:23
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
Your Filters
Interested
Ignored
     
0 OriginalGriff 273
1 Sergey Alexandrovich Kryukov 179
2 Maciej Los 136
3 Richard MacCutchan 125
4 Tadit Dash 100
0 Sergey Alexandrovich Kryukov 10,264
1 OriginalGriff 7,917
2 CPallini 4,181
3 Rohan Leuva 3,522
4 Maciej Los 3,125


Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 8 May 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid