Inserting records using LinqToSql
I wasn't able to find any good examples on Google (they were all for old CTPs).
So to all that this may help, this is how you can insert a record into SQL using Linq (LinqToSQL).
NorthWindDataContext db = new NorthWindDataContext(); Product prod = new Product(); prod.ProductName = "The Dave Special"; prod.CategoryID = 1; prod.UnitPrice = 24; prod.UnitsInStock = 1; //This is the line I kept missing db.Peoples.InsertOnSubmit(prod); db.SubmitChanges();
A shout out to Jordan Knight for helping me with this