Home

MySql - linq to sql issue inserting a new record

Any update or insert operation will result in an error. I have a local MySQL database but on insert I get an error that doesn't make sense.

Here is the code:

var hack1074 = Hackathons.Where(h => h.Id.Equals(1074)).First();
var hackathon_oneweek = new Hackathon_oneweek()
{
Hackathon_id = hack1074.Id,
Hackathon_preview_date = new DateTime(2017, 4, 1)
};
Hackathon_oneweeks.InsertOnSubmit(hackathon_oneweek);
SubmitChanges();

The error occurs on SubmitChanges() :
ArgumentNullException: Value cannot be null.
Parameter name: key

If I use an insert statement in MySQL Workbench it will succeed.
What should I look for?

Thank you,
Dave

Comments

  • I believe I found the issue. The database was setup for replication but replication was not working and because of that the update would fail since it couldn't transfer the log to the slave database. I'm not sure what the error means in this situation. Now I understand how important it is not to leave replication in a bad state even in sandbox environment.
Sign In or Register to comment.