Click here to Skip to main content
14,698,142 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

I have access control application called db digitus which is used SQL server to storing data and retrieving. once i search for access control even report , i am getting this error "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding". Can anybody help me to fix this issue please?

thank you

What I have tried:

as i wanted my data to be safe i did not try anything before someone suggest me good answer here
Updated 3-May-20 3:33am

NadhVanim 3-May-20 2:56am
Hi RickZeeland,

thank you for your prompt reply, can you please instruct how can i go this option and where i do the changes ? i am not bold in SQL Server, but i am confident i can fix this issue with the help of someone like you
The error that you are getting indicates that the calling program has a time limit and that the time limit is insufficient for the query that you are calling.

The default timeout for an SqlConnection is 30 seconds. You can override this be setting the timeout in the connection string definition. In traditional Net Framework this would be done in either the app.config file or the web.config file for an ASP.NET website (broken out to several lines for viewability)
      <add name="nmConn" connectionString="Server=nmServer; Database=nmDB;
                                           User Id=nmUser;  Password=pwUser;
                                           Connection Timeout=60" />
Similar to the SqlConnection, there is also a timeout for the individual SqlCommand. This would be updated within the block of code that is calling the actual command. Here is an example in C#
string connString = "";
string cmdText = "";

using (SqlConnection conn = new SqlConnection(connString)) {  

   SqlCommand cmd = new SqlCommand(cmdText, conn);  
   cmd.CommandTimeout = 60;                       // set TimeOut here

   try { cmd.ExecuteNonQuery(); }  
   catch (SqlException sx) {
      // provide information from {sx}
Microsoft Docs: Configuration Files Connection Strings[^]
Microsofy Doc: Sql Command Connection Timeout[^]
This is all find and dandy, but many times this is just a bandage for another problem. Proper troubleshooting should determine Why is this happening
Find out which command is having the problem and then try that out in an SQL IDE such as Sql Server Management Studio and see how long it actually takes to run. There are tools within there that can help you (such as Show Execution Plan) which can show what is slowing it down and sometimes has possible fixes (such as missing indexes).

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900