Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

System.Data.SqlClient.SqlException: Timeout expired

Posted on 2004-08-04
5
Medium Priority
?
13,876 Views
Last Modified: 2011-08-18
I am getting the following exception -

System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

On the google I found I need to update the commandTimeOut property. How much do I need to update it and where should I update it.

My application is windows application

Thanks
0
Comment
Question by:jra2002
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:Arragorn
ID: 11718636
Hi jra2002,

You can change the the timeout period by setting the CommandTimeout property of your command object. This property is in seconds. For Example to set your timeout property to 2 mins (120 secs)
EX:

dim myCmd as SQLCommand
myCmd.CommandTimeout = 120

To determine what to set the timeout to it is important to know why the timeout is occuring. Is this a long running query etc.


John Crenshaw
john.crenshaw@ky.gov
john@jcdl.net

Consultants are people who borrow your watch to tell you what time it is, then walk off with the watch.

0
 

Author Comment

by:jra2002
ID: 11718798
Dear John,
previously I had never has the problem of Timeout Today is the first tine I am getting this error

Thanks
0
 
LVL 4

Accepted Solution

by:
Arragorn earned 60 total points
ID: 11718889
jra2002,

If this is the first time the problem has occured then I would suspect some other external issues such as  A problem with the SQL Server running slow or poorly,  Is anyone else processing on the server and it is just simply to busy?  Or it could be that the some other process on the server is hung or eating up all of the processor time.  I would try and run the same type of query from Query analyser and see what I get.
0
 

Author Comment

by:jra2002
ID: 11719286
Dear Arragorn
You are right. It's not the program error. Database is locked
0
 

Expert Comment

by:cdzuniga
ID: 12128226
I am experiencing the same problem, but it is not timing out from Query Analyzer, only from the app. I have cmd.CommandTimeout = 600 in the class. The server is config'd for the same. But the app times out after 25 sec. What gives?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
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. …
Suggested Courses

885 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