c# - Linq to SQL Data context doesnt commit if multiple inserts are called on table with auto increment -
I am having a problem while trying to insert two at a time An automatic increment in the table is the primary key If the comments objects are not set up, the id value is not set so that the database can be assigned to it.
My code works for single inserts if I send directly, but if I try and do multiple InsertOnSubmit then it does not feel like Ignore, and does not give any error or exception Even if my code is within an attempt and hold block
Example 1 (this is not committed to the database)
// my comment is started with data dc.tblDailyComments.InsertOnSubmit (mycomment); // myComment2 different data has been started with dc.tblDailyComments.InsertOnSubmit (myComment2); // When it is said that this database is not committed to dc.ubmitchange ();
Example 2 (this works fine)
// My information data has been started with dc.tblDailyComments.InsertOnSubmit (mycomment); // database dc. SubmitChanges (); // myComment2 different data has been started with dc.tblDailyComments.InsertOnSubmit (myComment2); // database dc. SubmitChanges ();
issue issued by Microsoft Barth to Microsoft
< / P>
Comments
Post a Comment