I would like to ask some issues. I have got some of entity exceptions.
I am using Entity Framework 6.2.0 in my C# Windows app and SQL Server 2017. My app is running with 8 client PCs and server.
I really don't know how to that exception is occur. Is it related to connection timeout? How to fix that?
I get this exception:
System.Data.Entity.Core.EntityException: An exception has been raised that is likely due to a transient failure.
If you are connecting to a SQL Azure database consider using SqlAzureExecutionStrategy.
System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition.
See the inner exception for details.System.Data.SqlClient.SqlException: Transaction (Process ID 58) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
Some code:
try
{
using (DataCtx.RTAD_BusinessLicenseEntities ctx = new DataCtx.RTAD_BusinessLicenseEntities())
{
err = "if(rv.TransactionStatus)=>InsertMode: " + this.txtSearchNRC.Text + ", " + this.TransactionID + ", " + paraChalenNumber.Value.ToString();
ctx.SP_Vehicle_ApproveForExtendOperatorLicense(Helper.convertToAnscii(this.txtSearchNRC.Text), this.TransactionID, paraChalenNumber, true, true, "Approved");
}
}
catch (Exception ex)
{
Helper.WriteErrorLog("User Input => " + err + "\n\n" + ex.ToString());
MessageBox.Show(ex.ToString(), "btnApply_Click_Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
}