I'm trying to insert data into a primary table and a dependent table at the same time. A database relationship does exist between the two tables, and table Employee have an Identity column as the Primary Key.
I'm trying:
Database.Employee emp = new Database.Employee()
{
x = DateTime.Now,
y = "xxx"
};
Database.Skill skill = new Database.Skill()
{
Skill = "Reading"
};
emp.Skills = skill; //Error on this line
dc.Employees.InsertOnSubmit(emp);
dc.SubmitChanges();
But I get the error that:
Cannot implicitly convert type 'Database.Skill' to 'System.Data.Linq.EntitySet'