You should note that Timeout property for SqlConnection object and Timeout property for SqlCommand object are different properties. By default command timeout is set to 30 seconds. Set it to 60, and your issue will be solved: commandObject.
Timeout = 60; But most likely that you should change your SQL procedure or split it to some parts.
The same answer was given yesterday! – Pinakin Shah Jul 20 at 8:26 @Pinakin Shah I've just edited my answer. Why down vote?
– VMAtm Jul 20 at 8:29 1 @Pinakin Shah Can you explain, why did you downvote it? I just added advice to refactor the sql. – VMAtm Jul 20 at 8:37 Your answer was same as given by me yesterday and I didn't check you had some added advice.
Will give you a vote up :) – Pinakin Shah Jul 20 at 9:50 @Pinakin Shah updated the answer, so please, remove your down vote :) (I'll never ever edit my old questions again) – VMAtm Jul 20 at 9:59.
Increase the query timeout. Connection timeout is only on the connection time. Presuming you are using SqlCommand, there is a timeout property in there.
Try running your SQL query using Microsoft SQL Server Management Studio, and click the "Estimated Execution Plan" button. This will tell you if you have any indexes missing. Adding the missing indexes should speed up your query.
This could be because you are setting the command timeout on the connection instead of the command object itself. Can't see your code but if you are using a DataReader, DataAdapter etc. Try setting CommandTimeout on those objects. A few other possibilities.
This could be because you are setting the command timeout on the connection instead of the command object itself. Can't see your code but if you are using a DataReader, DataAdapter etc. Try setting CommandTimeout on those objects. A few other possibilities: the connection timeout is being exceeded before the query is being run.
Not likely, but still, what is the connection timeout? It should be >= any CommandTimeout. The CommandTimeout call is not being executed.
Something else is later overriding the CommandTimeout call.
Aaron, sorry I should have include my code. Not sure on what you mean by setting the commandTimout on object. Thanks for the other suggestions.
Greatly appreciated. – chaydee Aug 1 at 0:57 Code: Private Function GetSampleData() As DataTable Dim DS As DataSet Dim objConn As New SqlConnection("Data Source=***;Initial Catalog=***;Integrated Security=True;Packet Size=4096;Connect Timeout=0;Max Pool Size = 300") Dim objCmd As New SqlCommand Dim myDataAdapter As SqlDataAdapter objCmd. CommandTimeout = 0 myDataAdapter = New SqlDataAdapter("GethierarchyTree", objConn) myDataAdapter.SelectCommand.
CommandType = CommandType. StoredProcedure myDataAdapter.SelectCommand.Parameters. Add(New param...blah.
– chaydee Aug 1 at 1:00 I suggest you update the question with that code so that it is much more readable than in a comment (use the {} button). – Aaron Bertrand Aug 1 at 2:07.
What you get with the Query Analyzer (or SSMS, these days) and what you application gets can be very different things, mostly due to parameter sniffing.
I believe that means the database operation took too long and it gave up.
This could be because you are setting the command timeout on the connection instead of the command object itself. Can't see your code but if you are using a DataReader, DataAdapter etc. try setting CommandTimeout on those objects. A few other possibilities.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.