存储过程已从后端成功执行,但未从前端成功执行 [英] Stored Procedure is executing successfully from backend but not from frontend
问题描述
我在执行存储过程时遇到问题.
实际上,我有一个用于数据库备份的存储过程,其中我为要在该服务器中备份的每个数据库实现了Cursors.为了执行数据库备份,我只需要在该SP中传递一个参数,即可以在其中进行备份的文件夹路径.
现在,当我从ASP.Net网页传递文件夹路径时,它在运行几乎30-45秒的同时备份了几个数据库,然后出现错误"超时到期". ''.
在操作完成之前超时时间已过或服务器没有响应.''.
其次,我从SQL 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.
推荐答案
尝试一下:
try this :
SqlCommand.Timeout = 1000;
请尝试根据要求更改命令对象的超时值.但这不是依靠超时的好主意.而不是更改SP.
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.
您可以在web.config中设置此值.例如,要更改一个特定页面的超时:
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>
有关更多详细信息,请参见http://msdn2.microsoft.com/en-us/library/e1f13641.aspx.
希望有帮助.
See http://msdn2.microsoft.com/en-us/library/e1f13641.aspx for more details.
Hope that helps.
这篇关于存储过程已从后端成功执行,但未从前端成功执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!