PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Prevent rowstate change for one column

Reply

Prevent rowstate change for one column

 
Thread Tools Rate Thread
Old 06-04-2006, 12:21 PM   #1
Carl
Guest
 
Posts: n/a
Default Prevent rowstate change for one column


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


  Reply With Quote
Old 06-04-2006, 01:50 PM   #2
Jim Hughes
Guest
 
Posts: n/a
Default Re: Prevent rowstate change for one column

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
>



  Reply With Quote
Old 06-04-2006, 02:47 PM   #3
Carl
Guest
 
Posts: n/a
Default Re: Prevent rowstate change for one column

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
>>

>
>



  Reply With Quote
Old 06-04-2006, 07:04 PM   #4
Jim Hughes
Guest
 
Posts: n/a
Default Re: Prevent rowstate change for one column

Then do a test to see If Not dataRow.HasChanges() before accepting them.

"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
>>>

>>
>>

>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off