I am having an issue when trying to submit two inserts at once. The table has a auto increment primary key. The comment objects set up dont have there ID value set so that the database can assign this.
My code works for single inserts if i submit straight away but if i try and do multiple InsertOnSubmit commands then it seems to do nothign, and returns no errors or exceptions even though my code is within a try and catch block. Has anyone else had this problem or do you know which direction i should be looking?
Example 1 (This doesn't commit to the database)
//myComment is initialised with data
dc.tblDailyComments.InsertOnSubmit(myComment);
//myComment2 is initialised with different data
dc.tblDailyComments.InsertOnSubmit(myComment2);
//when this is called it does not commit to the database
dc.SubmitChanges();
Example 2 (This works fine)
//myComment is initialised with data
dc.tblDailyComments.InsertOnSubmit(myComment);
//commits to the database
dc.SubmitChanges();
//myComment2 is initialised with different data
dc.tblDailyComments.InsertOnSubmit(myComment2);
//commits to the database
dc.SubmitChanges();