Wednesday, March 7, 2012

Operation cancelled by user

Hello Guys,

I am currently experiencing a Sql error: operation cancelled by user.

I don't know where this error come from. Is it from ADO.NET or SQL Server 2000.

This error doesn't always occur. It only occurs when many users access the web site. I want to know who issue the error. Why issue the error.

Let me know if you have any ideas

Thanks in advanced

See if the following post helps

http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.adonet/topic10278.aspx

|||

Hi Raj Kasi,

Thanks for replying. I did not use sqlcommand.cancel(). Also, the error occurs before I call the finally.

Here is my code:

Dim sqlConnection As New sqlConnection(ConfigurationSettings.AppSettings(String.Format("db.{0}.SQLconnString", Env)))

Dim sbTable As New StringBuilder

Dim strCmpy As String

Dim tblCounters As String

strCmpy = Server.UrlDecode(Request.Cookies("Companies").Value)

Dim sqlCommand As New sqlCommand("sp_getCompanyInfo", sqlConnection)

Dim sqlDataReader As sqlDataReader

Dim myParam As SqlParameter

Dim errLog As New errReport

Try

sqlCommand.CommandType = CommandType.StoredProcedure

sqlConnection.Open()

myParam = sqlCommand.Parameters.Add("@.Companies", SqlDbType.VarChar, 50)

myParam.Value = strCmpy

myParam = sqlCommand.Parameters.Add("@.Class", SqlDbType.VarChar, 2)

myParam.Value = selClass

myParam = sqlCommand.Parameters.Add("@.BrchTmpl", SqlDbType.VarChar, 6)

myParam.Value = selBrchTmpl

sqlDataReader = sqlCommand.ExecuteReader()

Catch ex As Exception

errLog.reportError("Error=" & ex.ToString())

Finally

If Not sqlCommand Is Nothing Then

If Not sqlConnection Is Nothing AndAlso sqlConnection.State <> ConnectionState.Closed Then

sqlCommand.Close()

End If

sqlCommand.Dispose()

End If

If Not sqlConnection Is Nothing Then sqlConnection.Dispose()

End Try

The error occurs when I call sqlCommand.ExecuteReader(). This error only occurs when many users come to use my asp.net application. I use asp.net 1.1 on windows 2000 server framework 1.1 with IIS 6.0.

Thanks

Troy123

|||

Hi Troy123,

Could you see if hitting "stop" or navigating away from the page during operation reproduces this problem? You may need to specify how you treat people navigating away from the page to ensure that it does not kill the back end process explicitly (or maybe you want that to lower the load on your server).

Hope something comes of this,

John (MSFT)

|||

Hi Guys,

I have found the problem. In other pages, I put command.cancel. Now, I removed all command.cancel. It is ok now.

I use ADO.NET 1.1. I think ADO.NET 1.1 doesn't manage command.cancel well.

Regards,

Troy123

No comments:

Post a Comment