473,322 Members | 1,379 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,322 software developers and data experts.

SQL exception timeout

Hi Guys,

I am running visual studio 2005 with asp.net v2.

I am calling records back from a database over a time period.
The application works great over a time period of less than 2 months,
however for over 2 months I get the following error:

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

I have changed the timeout property in sql enterprise manager to 60
(seconds)

and have the following line now in my code:

exceptionsSqlCommand.CommandTimeout = 60

Can anyone shed any light on how to fix this problem?? I have read some
references to changinh the machine.config file??

Any help wuld be much apprecieated,

Simon

Dec 14 '06 #1
6 1669
Have you set the timeout in the connection string?
Dec 14 '06 #2
Your timeout is 60 seconds - is your query taking beyond that?

Is it also possible that there is an issue with the server, such as database
deadlocking or the server is overwhelmed?

Normally changing the CommandTimeout is all that is necessary.

"si_owen" <s.****@sstaffs.gov.ukwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
Hi Guys,

I am running visual studio 2005 with asp.net v2.

I am calling records back from a database over a time period.
The application works great over a time period of less than 2 months,
however for over 2 months I get the following error:

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

I have changed the timeout property in sql enterprise manager to 60
(seconds)

and have the following line now in my code:

exceptionsSqlCommand.CommandTimeout = 60

Can anyone shed any light on how to fix this problem?? I have read some
references to changinh the machine.config file??

Any help wuld be much apprecieated,

Simon

Dec 14 '06 #3
I have set it in the command line and in enterprise manager only.

How do u set it in the connection string?

I am timing they load at currently 30 seconds before timeout, so its
not even reaching the new 60 seconds constraint I have set.

any ideas??

Simon

Robinson wrote:
Have you set the timeout in the connection string?
Dec 14 '06 #4
Well when it comes to timing, there are a lot of possible variables in there
you know - such as how the query is constructed. It isn't neccessarily
linear in time. Anyway, you can put the timeout in the connection string
with:

; CommandTimeout=60;

Post some code and it will be easier to see. Are you executing a stored
procedure?
"si_owen" <s.****@sstaffs.gov.ukwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
>I have set it in the command line and in enterprise manager only.

How do u set it in the connection string?

I am timing they load at currently 30 seconds before timeout, so its
not even reaching the new 60 seconds constraint I have set.

any ideas??

Simon

Robinson wrote:
>Have you set the timeout in the connection string?

Dec 14 '06 #5
no stored procedure heres the code that i have added recently that has
slowed down the data recovery:

For Each tempItem In RadGrid1.MasterTableView.Items

If tempItem.Cells(6).Text <"0" Then
Dim tokenString As String = tempItem.Cells(7).Text
Dim dateString As String = tempItem.Cells(2).Text
Dim transactionTimeString As String =
tempItem.Cells(3).Text

Dim exceptionsSqlString As String = "SELECT
tblExep.TransactionTime, tblExep.TokenNumber, tblExep.Date,
tblExepType.fNumber, tblExep.ExceptionType, tblExepType.fName FROM
PFWTRAN.dbo.Exceptions AS tblExep INNER JOIN dbo.ExceptionTypes AS
tblExepType ON tblExepType.fNumber = tblExep.ExceptionType WHERE
(tblExep.TokenNumber = " & tokenString & ") AND (tblExep.Date = " &
dateString & ") AND (tblExep.TransactionTime = " &
transactionTimeString & ")"
Dim exceptionsSqlConnection As New
SqlConnection(ConfigurationManager.AppSettings("Pl antime.ConnectionString"))
Dim exceptionsSqlCommand As New
SqlCommand(exceptionsSqlString, exceptionsSqlConnection)
exceptionsSqlCommand.CommandTimeout = 60
Dim exceptionsSqlDataReader As SqlDataReader

tempItem.Cells(6).Text = ""
Dim count As Integer = 0

exceptionsSqlConnection.Open()
exceptionsSqlDataReader =
exceptionsSqlCommand.ExecuteReader

While exceptionsSqlDataReader.Read
If count 0 Then
tempItem.Cells(6).Text &= ", "
End If

Dim infoString As String = ""

Select Case
RTrim(LTrim(UCase(exceptionsSqlDataReader(5))))
Case Is = "NO BREAK"
infoString = "You did not swipe out for
lunch"
Case Is = "SHORT BREAK"
infoString = "Your lunch break was less
than 30 minutes"
Case Is = "CORE AM"
infoString = "You swiped between 9:30 and
12:00"
Case Is = "CORE PM"
infoString = "You swiped between 14:00 and
16:30"
Case Is = "NOT OUT"
infoString = "You did not swipe out at the
end of the working day"
End Select

tempItem.Cells(6).Text &= "<a title='" & infoString
& "'>" & exceptionsSqlDataReader(5) & "</a>"
count += 1
End While

exceptionsSqlConnection.Close()
Else
tempItem.Cells(6).Text = "---"
End If

..............................................next

could you please point out where exactly to place the timeout line in
the connection string as when I try I get errors in the code.

Cheers,

Simon
Robinson wrote:
Well when it comes to timing, there are a lot of possible variables in there
you know - such as how the query is constructed. It isn't neccessarily
linear in time. Anyway, you can put the timeout in the connection string
with:

; CommandTimeout=60;

Post some code and it will be easier to see. Are you executing a stored
procedure?
"si_owen" <s.****@sstaffs.gov.ukwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
I have set it in the command line and in enterprise manager only.

How do u set it in the connection string?

I am timing they load at currently 30 seconds before timeout, so its
not even reaching the new 60 seconds constraint I have set.

any ideas??

Simon

Robinson wrote:
Have you set the timeout in the connection string?
Dec 14 '06 #6
You can't, this is not a connection level property. It is a command level
property.

I have never heard of the CommandTimeout property not being honored. Perhaps
there is something else going on such that the code isn't running in the way
you think it is.

"si_owen" <s.****@sstaffs.gov.ukwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
>I have set it in the command line and in enterprise manager only.

How do u set it in the connection string?

I am timing they load at currently 30 seconds before timeout, so its
not even reaching the new 60 seconds constraint I have set.

any ideas??

Simon

Robinson wrote:
>Have you set the timeout in the connection string?

Dec 14 '06 #7

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

Similar topics

0
by: jalil | last post by:
I am using Python 2.4 and get this exception when running my mod_python application. This used to work in my older environment. Any ideas on how I can debug this issue? -Jalil Mod_python...
0
by: Adrian Casey | last post by:
I have a python script which uses pexpect and I want to timeout (i.e. raise pexpect.TIMEOUT) if a long running command does not produce the output I am expecting. To simulate the 'long running...
4
by: Anders Borum | last post by:
Hello! I am working on improving my threading skills and came across a question. When working with the ReaderWriterLock class, I am getting an unhandled exception if I acquire a WriterLock with...
0
by: Andy | last post by:
I have an .aspx application that is running on an N-Tier platform. I keep getting the following error: "System.Exception: Timeout expired. The timeout period elapsed prior to completion of the...
3
by: Rahul Anand | last post by:
As per our requirements we have a web service which internally connects (Simple HTTP Post Request) to a remote server to initiate some work. We are calling the web service method asynchronously...
0
by: Mahesh Devjibhai Dhola | last post by:
Hi, I am getting the following exception when using webservice.. "The underlying connection was closed: An unexpected error occurred on a receive" I am not getting any innerexception so no clue...
3
by: Amar Gaikwad | last post by:
Hi All, I want to read the contents (only the filenames) from the ftp server. The code which I have throws connection timeout exception :: "A connection attempt failed because the connected...
5
by: Pavils Jurjans | last post by:
Hello, Is there any way I can intercept the session timeout exception, and 1) Run some code routine, ie log the error and it's context 2) Show nicer output to the user Please do not suggest...
4
by: Bgreer5050 | last post by:
I keep getting the following error on an asp form I have on my site. I know the smtp settings are correct, because if I take out the user fields (i.e. name, weight and assign a text string in code...
2
by: senglory | last post by:
My WCF: public interface IWorkbookService { DataTable GetDownpayments(KeyValuePair<int, string> sgm); } class WorkbookService : IWorkbookService
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.