Re: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
- From: "Rick" <rfemmer@xxxxxxxxxxxxxxxxx>
- Date: Tue, 30 Oct 2007 11:43:40 -0500
The command timeout is set to 120 and the connection timeout is 500, the
command is executing a stored proc that inserts 1 record. The stored proc
works as expected, it will return 'SUCCESS' on insert or the error message
from the stored proc if it failed. As I said, It only happens randomly. And
it happens on the _cn.open
Private _cn As System.Data.SqlClient.SqlConnection
_cn = New SqlConnection(connectionstring here)
strSQL.Append("EXEC usp_InsertTblLookupDataReference ")
strSQL.Append(PARAMETERS HERE)
If Not _cn.State = ConnectionState.Open Then
_cn.Open()
End If
Dim returnValue As String = ""
countParam = New SqlClient.SqlParameter("@insertSuccess",
SqlDbType.NVarChar, 4000)
localSQL = New System.Data.SqlClient.SqlCommand(strSQL.ToString, _cn)
localSQL.CommandTimeout = 120
countParam.Direction = ParameterDirection.Output
localSQL.Parameters.Add(countParam)
localSQL.ExecuteNonQuery()
returnValue = localSQL.Parameters("@insertSuccess").Value.ToString
If returnValue.ToUpper <> "SUCCESS" Then
Throw New Exception("Error Inserting TblLookupDataReference record:" &
returnValue & " - " & strSQL.ToString)
End If
If _cn.State = ConnectionState.Open Then
_cn.Close()
End If
"WenYuan Wang [MSFT]" <v-wywang@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:Z7kZ2QuGIHA.5176@xxxxxxxxxxxxxxxxxxxxxxxxx
Hello Rick,
Thanks for Norman's suggestion.
I noticed the exception was raised by SqlCommand.ExecuteNonQuery() method.
Stack Trace:
..
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
Have you tried increasing the SqlCommand.Timeout property?
The default value of SqlCommand is 30 (30 seconds).
It seems this process need much more time to run. Maybe you should
increase
the timeout of this command.
Hope this helps.
Best regards,
Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
.
- Follow-Ups:
- References:
- Prev by Date: FillSchema and stored procedure IF statements
- Next by Date: is there anything like XmlDocument.ImportNode but for SQL Server XQuery?
- Previous by thread: RE: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
- Next by thread: Re: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
- Index(es):
Relevant Pages
|