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
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