Time out on procedure calling from C# code
I am calling one procedure in SQL Server from my C# application. This procedure is returning 5 tables from the database. When the filter date is less its working fine from application. But when the between dates are high, its returning the tables in less than 5 milliseconds when i execute from database, but when i try to run the procedure from C# code and get a data set object its showing time out error. what may be the reason. can any one help.
Re: Time out on procedure calling from C# code
Did you try to increase the CommandTimeout?
Re: Time out on procedure calling from C# code
Quote:
Originally Posted by
VictorN
Did you try to increase the CommandTimeout?
My problem somewhat solved by setting the command time out to higher value. But still i have a major issue in place. When i run the procedure direct from sql server with the input values it runs very fast in less than 1 second, but when its called through the application its taking more than 1 minute to complete the execution and fill the data set. can you help me in fixing this scenario.
Re: Time out on procedure calling from C# code
How do you access the tables? Do you call the tables directly? Are you calling a stored procedure?
Re: Time out on procedure calling from C# code
Are you using any transactions in your stored procedure? Uncommitted transactions will cause this exact error message.+
Do you have access to SQL Profiler (doesn't come with Express edition) to get both actual execution plans? If not you can follow the advice in this answer to get the plans.