-1

hi I'm getting an error Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
I'm alredy changed the connect timeout = 60000 and in database my procedure is executes in 43sec. so plz give me some perfect solution

thank you

VMAtm
  • 27,943
  • 17
  • 79
  • 125
amer khan
  • 71
  • 1
  • 3
  • 8
  • 2
    There isn't enough information here to tell what you're doing, or what could be causing your problem. – forsvarir Jul 19 '11 at 06:58
  • @amer Please provide more details. Which languages are you working in? Are you using a library, framework, CMS? What is the server technology you're communicating with? Are you attempting to query a database, read a file? Currently your question lacks very vital information which may result in it being closed. – Sampson Jul 19 '11 at 07:03
  • @Jonathan the error is a typical ado.net / sql error but its true more information could have helped. Atleast some sensible tagging. – Pinakin Shah Jul 19 '11 at 07:46
  • 1
    You will need to give some more information in order for anyone to solve this. Can you post some relevant code for example? – Matt Wilko Jul 19 '11 at 08:25
  • Please do not ask the same question repeatedly. The community has already told you that you are not providing enough information to be able to help you. Please update **this** question with more information then flag to have it re-opened. Thanks – Kev Jul 19 '11 at 17:00
  • @amer khan Please review my answer. I'm sure it will solve your problem. – VMAtm Jul 20 '11 at 06:46

3 Answers3

18

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

VMAtm
  • 27,943
  • 17
  • 79
  • 125
4

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.

m-smith
  • 2,943
  • 4
  • 25
  • 39
1

Increase the query timeout. Connection timeout is only on the connection time. Presuming you are using SqlCommand, there is a timeout property in there.

Pinakin Shah
  • 877
  • 2
  • 12
  • 25