TableAdapter.UpdateAll(Dataset) 正在更新表中的所有列
C#、VS2010
创建了一个 Datagridviewer 并将数据库表拖/放到 Windows 窗体上。
创建了“更新 CommanTex”:
UPDATE minerals
SET Tritanium = @p0, Pyerite = @p1, Mexallon = @p2, Isogen = @p3, Nocxium =
@p4, Zydrine = @p5, Megacyte = @p6, Morphite = @p7
当我通过 DataGridViewer 进行编辑并使用 VS2010 自动生成的保存按钮进行保存时,这似乎会更新数据库中的每个字段。
如何让 Datagridviewer 只更新已更改的字段?
C#, VS2010
Created a Datagridviewer and Drag/Dropped the Database table onto a windows form.
Created the "Update CommanTex":
UPDATE minerals
SET Tritanium = @p0, Pyerite = @p1, Mexallon = @p2, Isogen = @p3, Nocxium =
@p4, Zydrine = @p5, Megacyte = @p6, Morphite = @p7
This seems to update every field in the database when I edit via the DataGridViewer and save using the save button auto-generated by VS2010.
How do I get the Datagridviewer to only update the fields that were changed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是
TableAdapter
和DataAdapter
的工作原理。他们总是会更新每一栏。像实体框架这样的 ORM 将在运行时生成 SQL,因此可以决定只为已更改的列生成 SET 子句。
That's how
TableAdapter
andDataAdapter
work. They will always update every column.An ORM like Entity Framework will generate the SQL at runtime, so can decide to only generate SET clauses for columns which have changed.