Home All Groups Group Topic Archive Search About

Prevent rowstate change for one column

Author
6 Apr 2006 11:21 AM
Carl
Hi!

I have an DataTable with one extra column that I've added manually, and is
not in the database. I use this col for various calculations, and it should
never be saved to the db. That works fine, except for one thing: when I
change the value in a row for that col, the RowState becomes Modified.
That's natural I guess, but it's unneccecary because it sends unmodified
rows to the db. Is there a way of marking a col as "computed" or other
technique to avoid changing the rowstate when changing that columns value?

regards

Carl

Author
6 Apr 2006 12:50 PM
Jim Hughes
datarow.AcceptChanges()

Show quote
"Carl" <ask4it> wrote in message
news:OlsQ1wWWGHA.3376@TK2MSFTNGP02.phx.gbl...
> Hi!
>
> I have an DataTable with one extra column that I've added manually, and is
> not in the database. I use this col for various calculations, and it
> should never be saved to the db. That works fine, except for one thing:
> when I change the value in a row for that col, the RowState becomes
> Modified. That's natural I guess, but it's unneccecary because it sends
> unmodified rows to the db. Is there a way of marking a col as "computed"
> or other technique to avoid changing the rowstate when changing that
> columns value?
>
> regards
>
> Carl
>
Author
6 Apr 2006 1:47 PM
Carl
That is not an option in my case, since there might (will) be other changes
to the row, and I do not wish to accept those changes.

Show quote
"Jim Hughes" <NOSPAMJ3033@Hotmail.com> wrote in message
news:e$zV9iXWGHA.1352@TK2MSFTNGP05.phx.gbl...
> datarow.AcceptChanges()
>
> "Carl" <ask4it> wrote in message
> news:OlsQ1wWWGHA.3376@TK2MSFTNGP02.phx.gbl...
>> Hi!
>>
>> I have an DataTable with one extra column that I've added manually, and
>> is not in the database. I use this col for various calculations, and it
>> should never be saved to the db. That works fine, except for one thing:
>> when I change the value in a row for that col, the RowState becomes
>> Modified. That's natural I guess, but it's unneccecary because it sends
>> unmodified rows to the db. Is there a way of marking a col as "computed"
>> or other technique to avoid changing the rowstate when changing that
>> columns value?
>>
>> regards
>>
>> Carl
>>
>
>
Author
6 Apr 2006 6:04 PM
Jim Hughes
Then do a test to see If Not dataRow.HasChanges() before accepting them.

Show quote
"Carl" <ask4it> wrote in message
news:ehMCmCYWGHA.4452@TK2MSFTNGP04.phx.gbl...
> That is not an option in my case, since there might (will) be other
> changes to the row, and I do not wish to accept those changes.
>
> "Jim Hughes" <NOSPAMJ3033@Hotmail.com> wrote in message
> news:e$zV9iXWGHA.1352@TK2MSFTNGP05.phx.gbl...
>> datarow.AcceptChanges()
>>
>> "Carl" <ask4it> wrote in message
>> news:OlsQ1wWWGHA.3376@TK2MSFTNGP02.phx.gbl...
>>> Hi!
>>>
>>> I have an DataTable with one extra column that I've added manually, and
>>> is not in the database. I use this col for various calculations, and it
>>> should never be saved to the db. That works fine, except for one thing:
>>> when I change the value in a row for that col, the RowState becomes
>>> Modified. That's natural I guess, but it's unneccecary because it sends
>>> unmodified rows to the db. Is there a way of marking a col as "computed"
>>> or other technique to avoid changing the rowstate when changing that
>>> columns value?
>>>
>>> regards
>>>
>>> Carl
>>>
>>
>>
>
>

AddThis Social Bookmark Button