linq 如何将DataGridView的数据更新到数据库中

link如何将DataGridView的数据更新到数据库中,如果没有变化,就不要更新。

那你要在更新前比对数据了 有变化再更新



NorthwindEntities db = new NorthwindEntities();

Customer cust = (from c in db.Customers

                 where c.CustomerID == "LAWN"

                 select c).Single();

cust.ContactName = "John Smith";

cust.Fax = "(800) 123 1234";

db.SaveChanges();

你会从 DataGridView 中获取数据吗?如果不会,考虑:在C#中,如何把DataGridview中的数据导出到一个Excel表中

写数据库,要看是什么数据库了。
几种数据库的大数据批量插入
DataTable的数据批量写入数据库