Can updating a dataset with the same value cause a basic update?

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

dataRow["someField"] = 2; // but it already had value 2!

Does this mean that the update statement must be executed in the database, or does it recognize that nothing has changed and the update has not been performed?

+3
source share
2 answers

Take a look at the DataRow.RowState property.

If the string was previously unchanged, then setting the value will change the value of RowState to Modified.

You will need to manually verify the equality before setting the row values.

+3
source

This will result in an update.

+1
source

Source: https://habr.com/ru/post/1773833/


All Articles