Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-07-03
3
Medium Priority
?
409 Views
Last Modified: 2012-05-07
I have developed windows project using visual studio 2005 with C# and sql express 2005.
In this project i am using attached mdf method for sql connecting string.
Mdf files attached in my local sytem (application path).
After build, I have installed successfully in another system.
while execute the exe first time  erroer will appear "Timeout expired. the time out period elapsed prior to completion of the operation or the server is not responding".
but next its working properly.. how to fix this problem.
Please any one help to solve this issue.

Thank you for your help.


StrConnSql1 = @"Server=.\SQLExpress;AttachDbFilename=|DataDirectory|\Data\d1.mdf; Database=testDB;Trusted_Connection=Yes;";
 
i am using the following connecting string

Open in new window

0
Comment
Question by:autopartsasia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
kjaswal earned 1500 total points
ID: 24773882
Is the timeout error for the connection or is it for the query you are trying to execute?  If the connection is timing out, you can add a "Connect Timeout=X" at the end of your connection string; where X is the number of seconds to wait for a connection to the server before terminating the attempt and generating an error.  So your connection string would look like:

StrConnSql1 = @"Server=.\SQLExpress;AttachDbFilename=|DataDirectory|\Data\d1.mdf; Database=testDB;Trusted_Connection=Yes;Connect Timeout=30";

for a 30 second timeout.  On the other hand, if your query is timing out, then you need to set the timeout on the actual SqlCommand object.  This is done via the SqlCommand.CommandTimeout property.  Again, this value is in seconds, see this link for a reference: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout(VS.71).aspx
0
 

Author Closing Comment

by:autopartsasia
ID: 31599482
Great
0
 

Author Comment

by:autopartsasia
ID: 24775994
Its is connection time out.. thanks for your help..
0

Featured Post

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

Question has a verified solution.

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

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
Viewers will learn the different options available in the Backstage view in Excel 2013.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

730 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