Jan 20, 2010 01:26 PM|katie_27|LINK
Hopefully I am posting this in the correct forum.
I am having a problem with my ASP.Net Web application. The application is developed using vb.net and is linked to a SQL Server database. Let me explain how the application works and the problem I am experiencing.
The system is an online web app which allows registered users to create a CV online. One of the pages within the app gives users the chance to add a cover note to their CV. The page that allows them to do this consists of only a textarea control and a button
control. The textarea allows users to input up to 4,000 characters.
Once the user clicks the ‘Save’ button to save their cover note info, the following code then executes.
This code checks to see if the CV already has cover note info, if it does, then the application runs an update statement, otherwise, it runs an insert statement.
The table within the database which records the cover note information is called tbl_covernote and has three columns, covernote_id (int and autoincrement), cv_id(int), covernote_text (nvarchar(max)).
The error which occurs sometimes is as follows:
Dim dr As SqlDataReader
Dim param(0) As SqlParameter
param(0) = New SqlParameter("cv_id", Session("cvID"))
dr = DataAccess.ExecuteDataReader(param, "sp_get_covernote_info")
If dr.HasRows Then
'RUN UPDATE STATEMENT
Dim objCoverNoteInfo As New cv_covernote_info
Dim returnVal As Integer
objCoverNoteInfo.CoverNoteInfoText = Server.HtmlEncode(txtArea_covernote_info.InnerText)
objCoverNoteInfo.cvID = Session("cvID")
returnVal = cv_covernote_info_DAO.UpdateCovernoteInfo(objCoverNoteInfo)
'RUN INSERT STATEMENT
objCoverNoteInfo. CoverNoteInfoText = Server.HtmlEncode(txtArea_covernote_info.InnerText)
objCoverNoteInfo. cvID = Session("cvID")
returnVal = cv_covernote_info_DAO.InsertCoverNoteInfo(objCoverNoteInfo)
'CLOSE CONNECTION TO THE DATABASE
Dim closeConn As Integer
closeConn = DataAccess.CloseConnectionString()
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
However, this error does not occur very often, maybe once or twice a week, and I have also noticed that it only seems to happen when an update to the cover note information is executed, not when an insert is done.
I have read a bit about this error and some people have advised me that it could be to do with the CommandTimeout of my DbCommand. However, I increased this to 120 and I am still having this problem.
If anyone could give me some help it would be much appreciated.