?
Solved

Change connectiontimeout in ADO.NET

Posted on 2008-11-01
3
Medium Priority
?
1,902 Views
Last Modified: 2013-12-17
Hi experts!

I have project with C#  , WindowsForms and Framework 2.0 with VS2008. I open connection to SQL Server 2005 and want to set different (smaller ) ConnectionTimeout . This property is read only, do I have other properties or way to chage it?  It is very borrow to wait 30 sec. In LAN connection&
0
Comment
Question by:dvplayltd
[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
3 Comments
 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22858321
use this

mycon.CommandTimeout = ... set your time here

mycon is connection object
0
 
LVL 19

Accepted Solution

by:
LordOfPorts earned 2000 total points
ID: 22858336
The connection string http://www.connectionstrings.com/?carrier=sqlserver2005 has an optional property for "Connection Timeout" http://articles.techrepublic.com.com/5100-10878_11-6084879.html# which you would set as in the example below (the actual connection string will depend on your type of connection).

CommandTimeout http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout.aspx is different than ConnectionTimeout http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectiontimeout.aspx
Provider=SQLNCLI;Server=myServerAddress;Database=myDataBase;Uid=myUsername; Pwd=myPassword;Connection Timeout=10;

Open in new window

0
 

Author Closing Comment

by:dvplayltd
ID: 31512369
Thank you very much for you time!I get answer to other me question - how to change connection port for SQL Server ( I will work with SQL Server with realIP via Internet).
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

777 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