I am currently trying to update values in my Database. My code worked flawlessly until I've added a new value to the Database. I have updated my DataClasses1.dbml and it shows the new column I have added to the Database. Still I am getting a Stackoverflowexception when context.SubmitChanges() gets called. The ChangeSet contains 2 Objects which should be updated (update 5 columns per row in this case)
var customers = new List<Customer>();
using (var context = new DataClasses1DataContext())
{
var result = from custs in context.Customer
where custs.ACTION_ID == desRequest.First().ACTION_ID &&
!custs.ARCHIVATED
select custs;
Inputvalidation.SetAddressLines(ref result);
context.SubmitChanges();
customers = result.ToList();
}
context.GetChangeSet shows:
{{Inserts: 0, Deletes: 0, Updates: 2}}
Deletes: Count = 0
Inserts: Count = 0
Updates: Count = 2
Before the update of each row I'm adding new customers from a json-post in nancyfx with this code (which to my surprise still works as intended)
private static bool AddItems(string request)
{
// Hier alle sammeln und in einem wisch rein
var customers = JsonConvert.DeserializeObject<IEnumerable<Customer>>(request);
foreach (var cstmr in customers)
{
using (var context = new DataClasses1DataContext())
{
context.Customer.InsertOnSubmit(cstmr);
try
{
context.SubmitChanges();
}
catch (Exception)
{
//TODO: Hier ggfs. reparieren
context.SubmitChanges();
return false;
}
}
}
return true;
}
These are the error-details: "Das Programm "[8028] iisexpress.exe" wurde mit Code -2147023895 (0x800703e9) beendet."
The Stacktrace shows null. What am I doing wrong and what can I improve?
I've deleted the "obj" Folder of my Solution and rebuilt the Project and everything works as intended again.
User contributions licensed under CC BY-SA 3.0