开发者

Does updating a dataset with the same value cause an underlying update?

Say I have a dataset, and I change a value in a datarow, but the value is identical to the old value:

开发者_如何学JAVA
dataRow["someField"] = 2; // but it already had value 2!

Does this cause an update statement to be executed on the database, or does it recognize that nothing actually changed and perform no update?


Take a look at the DataRow.RowState property.

If the row was previously Unchanged,then setting the value will change the RowState to Modified.

You will need to manually check for equality before setting row values.


It will cause an update.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜