PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Prevent rowstate change for one column
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Prevent rowstate change for one column
![]() |
Prevent rowstate change for one column |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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 >> > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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 >>> >> >> > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

