首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

跪求解决办法,linq to entity,entity sql

2012-07-29 
跪求解决方法,linq to entity,entity sql公司正用linq to entity实现项目开发,我现在接手的任务是将一个表

跪求解决方法,linq to entity,entity sql

公司正用linq to entity实现项目开发,我现在接手的任务是将一个表中的数据选择性的插入另一个表中,
无论是linq to entity、linq to sql还是entity sql好像都不支持 DML 语句(insert、update、delete);
我该怎么办啊,那位大哥有好办法啊,把我愁坏了。解决不了就只能一个字段一个字段的赋值了,那样我会疯掉的
表中字段太多了。。。。

[解决办法]

C# code
Northwnd db = new Northwnd(@"c:\Northwnd.mdf");// Query for a specific customer.var cust =    (from c in db.Customers     where c.CustomerID == "ALFKI"     select c).First();// Change the name of the contact.cust.ContactName = "New Contact";// Create and add a new Order to the Orders collection.Order ord = new Order { OrderDate = DateTime.Now };cust.Orders.Add(ord);// Delete an existing Order.Order ord0 = cust.Orders[0];// Removing it from the table also removes it from the Customer’s list.db.Orders.DeleteOnSubmit(ord0);// Ask the DataContext to save all the changes.db.SubmitChanges(); 

热点排行