Click here to Skip to main content
12,767,637 members (52,274 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET SQL SQL-Server Backup , +
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 3:30am
Comments
Mantu Singh 7-May-12 8:33am
   
Pls post code where you got error.......!
ryanb31 7-May-12 8:35am
   
How long does it take to run in the query window?
B Birajdar 7-May-12 9:52am
   
Use SQL server profiler to check whats happening during execution
losmac 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 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
 
good
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.
  Permalink  
Comments
digimanus 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 8-May-12 9:24am
   
Good answer, my 5!
Rate this: bad
 
good
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">
        <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: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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 8 May 2012
Copyright © CodeProject, 1999-2017
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