473,414 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

SQL timeout error

I am trying to perform a very long query on an MSSQL database, using
ASP.NET, and making the code behind in VB.NET. I have been receiving timeout
error, so I thought I would add Connect Timeout to my connection string.
However this appears to have no effect. The connection string is set up as
follows

Dim conn As New SqlClient.SqlConnection("Data Source=serverName; User
ID=userName; Password=password; Connect Timeout=9999")

Any ideas why this isn't changing the timeout?

Thanks,
Martin

Jul 31 '06 #1
6 7762
Martin,

I think the most accepted method of doing this is through the
CommandTimeout property of the SqlCommand object. Set it to 0 for an
infinite timeout. Here's the msdn link:

http://msdn2.microsoft.com/en-us/lib...ndtimeout.aspx

Hope this helps,
Gary

Martin Eyles wrote:
I am trying to perform a very long query on an MSSQL database, using
ASP.NET, and making the code behind in VB.NET. I have been receiving timeout
error, so I thought I would add Connect Timeout to my connection string.
However this appears to have no effect. The connection string is set up as
follows

Dim conn As New SqlClient.SqlConnection("Data Source=serverName; User
ID=userName; Password=password; Connect Timeout=9999")

Any ideas why this isn't changing the timeout?

Thanks,
Martin
Jul 31 '06 #2
What you are setting is the connection timeout. That means how long the
connection waits while trying to connect to the database server before
giving up.

This is in no way related to the timeout when executing commands. Not sure
why you thought it would be.

Follow Gary's advice for setting the CommandTimeout to control the timeout
while executing commands.

"Martin Eyles" <ma**********@NOSPAMbytronic.comwrote in message
news:12*************@corp.supernews.com...
>I am trying to perform a very long query on an MSSQL database, using
ASP.NET, and making the code behind in VB.NET. I have been receiving
timeout
error, so I thought I would add Connect Timeout to my connection string.
However this appears to have no effect. The connection string is set up as
follows

Dim conn As New SqlClient.SqlConnection("Data Source=serverName; User
ID=userName; Password=password; Connect Timeout=9999")

Any ideas why this isn't changing the timeout?

Thanks,
Martin

Jul 31 '06 #3
Thanks,
Works perfectly,
Martin

"Gary" <gg********@neo.rr.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Martin,

I think the most accepted method of doing this is through the
CommandTimeout property of the SqlCommand object. Set it to 0 for an
infinite timeout. Here's the msdn link:

http://msdn2.microsoft.com/en-us/lib...ndtimeout.aspx

Hope this helps,
Gary

Martin Eyles wrote:
>I am trying to perform a very long query on an MSSQL database, using
ASP.NET, and making the code behind in VB.NET. I have been receiving
timeout
error, so I thought I would add Connect Timeout to my connection string.
However this appears to have no effect. The connection string is set up
as
follows

Dim conn As New SqlClient.SqlConnection("Data Source=serverName; User
ID=userName; Password=password; Connect Timeout=9999")

Any ideas why this isn't changing the timeout?

Thanks,
Martin

Jul 31 '06 #4
Yes,

You getting the settings wrong.

Connect Timeout is the amount of time to ~find the server.

Command Timeout is the amount of time.. for instance, a proc runs before
timing out.

You need Command Timeout.


"Martin Eyles" <ma**********@NOSPAMbytronic.comwrote in message
news:12*************@corp.supernews.com...
I am trying to perform a very long query on an MSSQL database, using
ASP.NET, and making the code behind in VB.NET. I have been receiving
timeout
error, so I thought I would add Connect Timeout to my connection string.
However this appears to have no effect. The connection string is set up as
follows

Dim conn As New SqlClient.SqlConnection("Data Source=serverName; User
ID=userName; Password=password; Connect Timeout=9999")

Any ideas why this isn't changing the timeout?

Thanks,
Martin

Jul 31 '06 #5
I'm having the same problem, but in my case, I'm using the default Database
adapter, not the Object adapter (middle tier). Hence, I don't see a way to
get a hold of the CommandTimeout property since I'm not the one that is
creating the SqlCommand object.

Am I stuck or is there another way? I'm not inclined to change my code to
use Object adapter at this point.

Thanks,
Jef

"Gary" wrote:
Martin,

I think the most accepted method of doing this is through the
CommandTimeout property of the SqlCommand object. Set it to 0 for an
infinite timeout. Here's the msdn link:

http://msdn2.microsoft.com/en-us/lib...ndtimeout.aspx

Hope this helps,
Gary

Martin Eyles wrote:
I am trying to perform a very long query on an MSSQL database, using
ASP.NET, and making the code behind in VB.NET. I have been receiving timeout
error, so I thought I would add Connect Timeout to my connection string.
However this appears to have no effect. The connection string is set up as
follows

Dim conn As New SqlClient.SqlConnection("Data Source=serverName; User
ID=userName; Password=password; Connect Timeout=9999")

Any ideas why this isn't changing the timeout?

Thanks,
Martin

Sep 20 '06 #6
Never mind. I found the solution in aspnet section. If anyone is interested,
the answer comes from Walter Wang:

You can set the select command's timeout value in SqlDataSource's Selecting
event:

protected void SqlDataSource1_Selecting(object sender,
SqlDataSourceSelectingEventArgs e)
{
e.Command.CommandTimeout = 30;
}

"jeff tu" wrote:
I'm having the same problem, but in my case, I'm using the default Database
adapter, not the Object adapter (middle tier). Hence, I don't see a way to
get a hold of the CommandTimeout property since I'm not the one that is
creating the SqlCommand object.

Am I stuck or is there another way? I'm not inclined to change my code to
use Object adapter at this point.

Thanks,
Jef

"Gary" wrote:
Martin,

I think the most accepted method of doing this is through the
CommandTimeout property of the SqlCommand object. Set it to 0 for an
infinite timeout. Here's the msdn link:

http://msdn2.microsoft.com/en-us/lib...ndtimeout.aspx

Hope this helps,
Gary

Martin Eyles wrote:
I am trying to perform a very long query on an MSSQL database, using
ASP.NET, and making the code behind in VB.NET. I have been receiving timeout
error, so I thought I would add Connect Timeout to my connection string.
However this appears to have no effect. The connection string is set up as
follows
>
Dim conn As New SqlClient.SqlConnection("Data Source=serverName; User
ID=userName; Password=password; Connect Timeout=9999")
>
Any ideas why this isn't changing the timeout?
>
Thanks,
Martin
Sep 20 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Achim Domma | last post by:
Hi, I'm using Python 2.3s timeout sockets and have code like this to read a page from web: request = ... self.page = urllib2.urlopen(request) and later:
4
by: Cath B | last post by:
I am pretty sure I am getting a command timeout when execute a SQL procedure that has an output parameter. The code below is in an asp page that is called using RSGetASPObject. I want to be able...
5
by: Jason | last post by:
Hi all I get the following error when executing a rather intense stored procedure from an ASPX page. I have tried: - Increasing timeouts on IIS 5.0 (all areas that even mention timeout) - use...
2
by: Chris Langston | last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server that is experiencing strange shutdown problems. We are using ASP.NET v1.1 and our application is written in VB.NET ...
4
by: Nevyn Twyll | last post by:
I've been working on an asp.net application and everything's been great. But suddenly, whether I'm tyring to use a database on my own machine, or on my server, I'm getting a timeout when trying to...
9
by: tshad | last post by:
I have the following in my web.config in my application root. <forms name="staffing" loginUrl="/applicant/EELogin.aspx" timeout="400" protection="All" path="/" /> I assumed this meant the...
5
by: supercooper | last post by:
I am downloading images using the script below. Sometimes it will go for 10 mins, sometimes 2 hours before timing out with the following error: Traceback (most recent call last): File...
2
by: Robin Becker | last post by:
While messing about with some deliberate socket timeout code I got an unexpected timeout after 20 seconds when my code was doing socket.setdefaulttimeout(120). Closer inspection revealed that...
1
by: Scorpion657 | last post by:
Hey I really need help. I have a Website coded using ASP.NET and VB and for some reason, i'm getting the following error when I try to upload or access a large file which is stored in the...
2
by: Andrew Cooper | last post by:
Greetings, I've got a website that has several pages with DataGrid controls on them. The controls are bound to Object Datasources. On one of the pages I keep getting a "Timeout expired. The...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.