c# - Linq to SQL: Why "This SqlTransaction has completed; it is no longer usable." -


I have three tables related to each other, they represent a hierarchical object.

  A_Table-> B_Table - & gt; C_Table  

I have given my error below to set the primary key values ​​to the same values ​​as before. When I submit the check (), it fails with an error after 30 seconds:

  "This SqlTransaction has been completed, it is no longer useful."  

I know that the primary key values ​​are the same as before and after. I am under the assumption that Linq to SQL only modifies field values ​​if they are not equal to existing field values. DataContext.log and SQL update statements are not included in this code during this code.

Why would this fail? Is it really trying to do some sort of comprehensive update to all Linq in Sql-RAM?

Text after "div class =" itemprop = "text">

Applying the items generated by default INotifyPropertyChanging for DBContext conversion tracking And in that case it would not have detected a similar value set.

In cases where the object does not apply INotifyPropertyChanging change tracking system> call for SubmitChanges ()

Take a look at an explanation for change tracking.

--- Update: This is not exactly right; Here is an excerpt from the DBContext designer.cs file for the Sql class:

  [global :: System.Data.Linq.Mapping.TableAttribute (name = "dbo.Tasks") ] Public partial class work: INotifyPropertyChanging, INotifyPropertyChanged {Private int _TaskId; [Global: System.Data.Linq.Mapping.ColumnAttribute (storage = "_TaskId", auto-sync = AutoSync.OnInsert, DbType = "none not identified NULL", IsPrimaryKey = true, IsDbGenerated = true)] Public Integer TaskId {{get it back ._TaskId; } Set {if ((this._TaskId! = Value)} {this.OnTasIdChanging (value); This.SendPropertyChanging (); This ._TaskId = value; This.SendPropertyChanged ("TaskId"); This.OnTaskIdChanged (); }}}}  

Is your primary key value integer and does your code check the previous values ​​like this?


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -