?
Solved

Timeout expired with SQL Server query

Posted on 2006-05-18
4
Medium Priority
?
367 Views
Last Modified: 2008-02-01
When running a stored procedure from my asp.net application I recieve the following error:
System.Data.SqlClient.SqlException: Timeout expired

The command object timeout property is set to the default of 30.

However when I run the same stored procedure in Query Analyzer it only take 6 seconds to complete.

What, other than the time it takes to execute the query, would cause a "timeout expired" error.
0
Comment
Question by:esc7
  • 2
4 Comments
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 16715211
Most likely your database is locked
restart your sql service and see if that happens
that can also open if you keep opening connections without closing them in your code. always check for the connection status before you open it

HTH
0
 

Author Comment

by:esc7
ID: 16715235
i restarted the service but no change.
i also checked to make sure that i am opening and closing a single connection... still no change.
0
 
LVL 27

Accepted Solution

by:
Sammy Ageil earned 2000 total points
ID: 16715314
Try to run sp_who2 from query analyzer while you are attempting to run this app and see if anything is blocking you
also make sure to setsqlcommand.timeout after you open your connection see if that makes a difference

Good luck
 
0
 
LVL 3

Expert Comment

by:vincent_figo
ID: 16715623
an infinite loop can also cause a timeout expired error... Maybe you can post the query here...
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question