Which means "Severe error in the current team. Results, if any, should be discarded." SQL Azure Error?

From time to time my code occurs

System.Data.SqlClient.SqlException The service has encountered an error processing your request. Please try again. Error code 40540. A severe error occurred on the current command. The results, if any, should be discarded. Class 20 Number 40197 

what happens very rarely, usually goes away in a minute or two, and I can’t reliably reproduce it. Sometimes the Error code can be a number other than 40540 .

I searched a little Google and it looks like it is caused by errors in SQL Server and is reproducible.

I have two options: repeat the request or treat it as fatal and break it badly. I would rather better understand what the problem really is, and whether I am safe to repeat the request.

Retry the request when this error occurs?

+4
sql-server-2008 azure azure-sql-database
Feb 11 '13 at 8:47
source share
2 answers

A quick google search gave me this.

The service encountered an error processing your request. Please try again. Error code% d. You will receive this error when the service is shut down due to software or hardware updates, hardware failures, or any other fault tolerance issues. Reconnecting to the SQL database server will automatically connect you to a healthy copy of your database. You can see error codes 40143 and 40166 embedded in error message 40540. Error codes 40143 and 40166 contain additional information about the fault tolerance that occurred. Do not modify the application to catch error codes 40143 and 40166. The application should catch 40540 and try to connect to the SQL database until the resources are available and your connection is established again.

You can visit here for more information. He says that your application should catch 40540 and try to connect to the SQL database until the resources are available and your connection is established again.

Although in a personal note, I would suggest not using Sql azure, since it is easily throttled, and you cannot manage the resources you have allocated. I did to install the sql server on azure vm and use it in my application.

Hope this helps you.

+6
Feb 11 '13 at 13:29
source share

I ran into a similar error: And I executed the answer at http://social.msdn.microsoft.com/Forums/en-US/bbe589f8-e0eb-402e-b374-dbc74a089afc/severe-error-in-current-command-during -datareaderread , which resolved the problem.

Avoid looping reader; load data into DataTable

 DataTable table = new DataTable(); table.Load(reader); reader.Close(); 
+1
Dec 10 '13 at 16:02
source share



All Articles