Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a stored procedure that is taking more time for execution when I am calling the same sp from C#.Net code.

I observed that whenever I am executing the same stored procedure from Microsoft SQL Server Management Studio, it's working fine.

I have no idea why this thing is happening?

Any help will be highly appreciated...

Thanks in advance!
Posted
Comments
zyck 8-Feb-12 4:37am    
can you post your Stored Procedure, if possible?
how many data or records do you retrieve when you execute your sp?
Sergey Alexandrovich Kryukov 8-Feb-12 4:40am    
How do you know you time it correctly? Most likely, the problem is there...
--SA
OriginalGriff 8-Feb-12 4:41am    
We would need to see the stored procedure, and the code you use to call it.
Some idea of the time difference would help too - are me talking millseconds? Minutes? Hours?
Use the "Improve question" widget to edit your question and provide better information.

1 solution

Below could be the issue because I had the same issue :

My assumption is as below with respect to your SP :
1) Stored procedure one or more column in return type which has data more than 10K characters
2)your sql server box and .Net framework box is different.


Root cause if above assumption is true.
When you run stored procedure from C# it will execute in seconds (may be) but take more time to transfer data from sql server box to framework box.

Solutions
If your are using this stored procedure to generate report then try to use SSRS report instead of .net data report

Since your question not state much details above could be your analysis point

Hope this helps if yes then accept and vote the answer otherwise revert back with your queries

--Rahul D.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900