Click here to Skip to main content
13,901,218 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
SQL Execution error

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

How to solve the timeout expired issue?
Posted
Comments
Malli_S 14-Sep-12 7:16am
   
In what case does it times out? While connecting or executing ?
If possible show up some code.
Swathi Nagaraj 14-Sep-12 8:16am
   
when I execute the following lines in server explorer, Raising SQL Execution error
Select Distinct EmployeeId, FName, LName from fn_Employee
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Change Connection string to increase time out:
Data Source=SomeDBServer;Initial Catalog=SomeDB;Provider=SQLNCLI10.1;Integrated Security=SSPI;Auto Translate=False;Connect Timeout=60;
   
v3
Comments
Swathi Nagaraj 17-Sep-12 5:55am
   
sqlcommand.CommandTimeout = 120;

This works fine sometimes, but sometimes rasies time out expired exception.
I want to know the reason, why it doesn't work sometimes?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Execute the query in Database side and verify where exactly the problem is,

Some of the problem causes,

It may be due to lock of that table,
There is no proper index creation on that table
May be there is a bunch of records like some lacks in that case create a maintainance plan to reorganize the indexes,
If you want the data for OLAP then put a nolock in the query,
Still you face the problem then check your command time out value from your application and change it accordingly.
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi,

I guess your transaction is processing the query on Large data, or some database connection problem may be there. The DB connection you have to find the cause but for the processing the large data below link may help you.

Improve the performance[^]

hope it helps.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.190306.1 | Last Updated 14 Sep 2012
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100