Nate Pet
Nate Pet

Reputation: 46242

AddObject and Save Not Working

I have a DBML where I have my table within a MVC environment.

db.TruckTable.AddObject(trucktbl);
db.SaveChanges();

It isn't working as it can't find AddObject() pertaining to the TruckTable. I am wordering if there is another way around this to make a table save that is in a DBML file.

Upvotes: 0

Views: 847

Answers (1)

Anders Abel
Anders Abel

Reputation: 69270

With linq-to-sql the method to add objects is called InsertOnSubmit() and saving changes is done through SubmitChanges().

db.TruckTable.InsertOnSubmit(trucktbl);
db.SubmitChanges();

Upvotes: 2

Related Questions