Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1663
  • Last Modified:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding

While Running Sql Query From Website. I get an error. The same query works for other Clients. For a Particular Client the other queries are working. but one query is not being executed. While Executing the query I get
"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding"
Error. I need your suggestions to fix it. I have increased Time out in web config. but then could not get the result. any other ways to do it.
0
Loganathan Natarajan
Asked:
Loganathan Natarajan
1 Solution
 
Rahul AgarwalTeam LeaderCommented:
May be this is due to the network connection with SQL Server. or Optimize the SQL query by putting index

SELECT column_list FROM table_name WITH (INDEX (index_name) [, ...]);
0
 
BuggyCoderCommented:
share your query and try to run it in ssms.
Also please check the execution plan and see what is the disk read cost and cpu cost.

This kind of problem in generally with query, also try writing SP for that so that Execution plan can be pregenerated.
0
 
paunraj21Commented:
My suggestions is to reduce the SQL query execution time. You know, there are some ways to do Optimize the SQL queries. Optimize the SQL query by putting index or limit.
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
gopaltaydeCommented:
Before disposing the connection object, close it. This should be done throughout the application.
0
 
ingriTCommented:
Are there any other queries running at the same time on one of the same tables? There could be a lock that it's waiting for.
0
 
Loganathan NatarajanLAMP DeveloperAuthor Commented:
I have added  sqlCommand.CommandTimeout = 0; I solved this issue.
0
 
Anthony PerkinsCommented:
I have added  sqlCommand.CommandTimeout = 0; I solved this issue.
For the record this is a very bad solution and should never be used.  It translates to:  "I don't care how long the query takes the user can wait indefinitely."  There are far better ways of solving this problem.
0
 
Loganathan NatarajanLAMP DeveloperAuthor Commented:
This Solution worked for my issue
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now