SQL Connection Timeout

D

David Lozzi

Hello,

I have a website I'm developing that will query a SQL database for basic
lists. If the database is unavailable, the site will continue to function as
a static site. The problem I'm running into is that when the SQL server is
unavailable, it takes a while for the page to load. I'm assuming its the
connection timeout for the SQL client. Defaults to 60 seconds? I don't know.
How can I specify the timeout to be like 5 seconds? I'm aware of the script
timeout property but I just want to specify the timeout for the SQL conn,
not the entire page of scripts, if possible.

Thanks,
 
S

Steven Cheng[MSFT]

Hi David,

I agree with KJ, as for connecting to a certain SqlServer instance, the
connecting timeout is specified by the SqlConnection class's
ConnectionTimeout property:
============
The time (in seconds) to wait for a connection to open. The default value
is 15 seconds.
==========

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "KJ" <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Subject: Re: SQL Connection Timeout
| Date: 7 Dec 2005 18:47:52 -0800
| Organization: http://groups.google.com
| Lines: 5
| Message-ID: <[email protected]>
| References: <OpJ$Q75#[email protected]>
| NNTP-Posting-Host: 66.65.235.143
| Mime-Version: 1.0
| Content-Type: text/plain; charset="iso-8859-1"
| X-Trace: posting.google.com 1134010077 17057 127.0.0.1 (8 Dec 2005
02:47:57 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Thu, 8 Dec 2005 02:47:57 +0000 (UTC)
| In-Reply-To: <OpJ$Q75#[email protected]>
| User-Agent: G2/0.2
| X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.8) Gecko/20050511 Firefox/1.0.4,gzip(gfe),gzip(gfe)
| Complaints-To: (e-mail address removed)
| Injection-Info: g14g2000cwa.googlegroups.com; posting-host=66.65.235.143;
| posting-account=-EvJ3wsAAABogc-QthV-9_6Q4JSAQJuo
| Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.gigan
ews.com!postnews.google.com!g14g2000cwa.googlegroups.com!not-for-mail
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:363543
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| SqlConnection sc = new SqlConnection();
| sc.ConnectionTimeout = 5;
|
| -KJ
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top