By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,543 Members | 2,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,543 IT Pros & Developers. It's quick & easy.

Mark a DataTable dirty

P: n/a
Hi;

How can I mark a DataTable as dirty (has changes)? I need
to do this because when I add a DataColumn to a
DataTable, it does not set HasChanges() to true.

thanks - dave
Nov 15 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi David,

DataTable itself doen't have a dirty property.
Instead, every row has RowState property which marks the row state.
If you want to mark all rows as changed you might loop through all of them
and set one of the fields to the same value.
BTW, what are you trying to achieve?

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

"David Thielen" <da**@windward.net> wrote in message
news:02****************************@phx.gbl...
Hi;

How can I mark a DataTable as dirty (has changes)? I need
to do this because when I add a DataColumn to a
DataTable, it does not set HasChanges() to true.

thanks - dave

Nov 15 '05 #2

P: n/a
I've found that when I programatically add a column - it
still returns false for HasChanges(). So in that case I
need to have a way to force HasChanges() to return true
after the column insertion.

I assume the way to handle this is do:
if (table.Row[0].DataState == DataRowState.Unchanged)
table.Row[0].DataState = DataRowState.Modified;
thanks - dave

-----Original Message-----
Hi David,

DataTable itself doen't have a dirty property.
Instead, every row has RowState property which marks the row state.If you want to mark all rows as changed you might loop through all of themand set one of the fields to the same value.
BTW, what are you trying to achieve?

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

"David Thielen" <da**@windward.net> wrote in message
news:02****************************@phx.gbl...
Hi;

How can I mark a DataTable as dirty (has changes)? I need to do this because when I add a DataColumn to a
DataTable, it does not set HasChanges() to true.

thanks - dave

.


Nov 15 '05 #3

P: n/a
That doesn't work - DataState is get only.

Any ideas how to set this?

thanks - dave

-----Original Message-----
I've found that when I programatically add a column - it
still returns false for HasChanges(). So in that case I
need to have a way to force HasChanges() to return true
after the column insertion.

I assume the way to handle this is do:
if (table.Row[0].DataState == DataRowState.Unchanged)
table.Row[0].DataState = DataRowState.Modified;
thanks - dave

-----Original Message-----
Hi David,

DataTable itself doen't have a dirty property.
Instead, every row has RowState property which marks the
row state.
If you want to mark all rows as changed you might loop

through all of them
and set one of the fields to the same value.
BTW, what are you trying to achieve?

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

"David Thielen" <da**@windward.net> wrote in message
news:02****************************@phx.gbl...
Hi;

How can I mark a DataTable as dirty (has changes)? I

need to do this because when I add a DataColumn to a
DataTable, it does not set HasChanges() to true.

thanks - dave

.


.

Nov 15 '05 #4

P: n/a

Hi asking again...

That doesn't work - DataState is get only.

Any ideas how to set this?

thanks - dave

-----Original Message-----
I've found that when I programatically add a column - it
still returns false for HasChanges(). So in that case I
need to have a way to force HasChanges() to return true
after the column insertion.

I assume the way to handle this is do:
if (table.Row[0].DataState == DataRowState.Unchanged)
table.Row[0].DataState = DataRowState.Modified;
thanks - dave

-----Original Message-----
Hi David,

DataTable itself doen't have a dirty property.
Instead, every row has RowState property which marks

the
row state.
If you want to mark all rows as changed you might loop

through all of them
and set one of the fields to the same value.
BTW, what are you trying to achieve?

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

"David Thielen" <da**@windward.net> wrote in message
news:02****************************@phx.gbl.. .
Hi;

How can I mark a DataTable as dirty (has changes)? I

need
to do this because when I add a DataColumn to a
DataTable, it does not set HasChanges() to true.

thanks - dave


Nov 15 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.