用linqpad来插入多条数据

其中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");


截图如下:

posted @ 2013-07-03 16:46  muzizongheng  阅读(496)  评论(0编辑  收藏  举报
如果我们时时忙着展现自己的知识, 将何从忆起成长所需的无知?