其中Customers为数据库的某个表名,
Custom自动被默认为单条记录的对象, 利用构造,InsertOnSubmit, 以及SubmitChanges实现插入数据。
注意:linqpad的language选择为C# Statement(s)
Customer cust = new Customer { ID=1000, Name="Bloggs" };
Customers.InsertOnSubmit (cust);
SubmitChanges();
Customers.Dump ("After inserting");
cust.Name = "Bloggs2";
SubmitChanges(); // Updates the customer
Customers.Dump ("After updating");
Customers.DeleteOnSubmit (cust);
SubmitChanges(); // Deletes the customer
Customers.Dump ("After deleting");
截图如下: