473,387 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Mark a DataTable dirty

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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: spamm | last post by:
I have this array with duplicate entries. Hundreds to be in fact. For example:Array = 17177 9661 9661 9535 9533 9533 9533 9533 9533 9533 9533 9533 9533 9533 9533 9533 9533 9533 9532 9532 9532...
6
by: Sean C. | last post by:
Helpful folks, I am having a hard time figuring out how to reduce my percentage of dirty page steal activity. Below are statistics for three fairly normal days, with the bufferpool hit ratios...
15
by: Rey | last post by:
Howdy all. Appreciate your help with several problems I'm having: I'm trying to determine if the Visit subform (subformVisits) has a new record or been changed, i.e. dirty. The form that...
2
by: Salad | last post by:
A97. I have a command button to save and exit. I had the code If Me.Dirty Then Docmd.RunCommand acCmdSaveRecord ...more code endif I was getting an error because a value was not getting...
1
by: RC | last post by:
If I want to explicitly save the record before executing a Close action. Which of the following should I use? Or does it depend on whether it is based on a Form or something else? If Me.Dirty...
1
by: RIP662 | last post by:
Okay all you GURUS out there... here's the skinny... I need a way to prevent the Me.Dirty event to trigger after a FORM_OPEN event. What I have is a field that is dependent on another field that...
9
by: Susan Bricker | last post by:
I am currently using the OnDirty event of a Form to detect whether any fields have been modified. I set a boolean variable. Then, if the Close button is clicked before the Save button, I can put...
2
by: VMI | last post by:
I have a datatable with emplcodes and I need to extract, from my Access table, all records that contain an emplcode included in my datatable. In other words, I need to do a query that accesses a...
7
by: archana | last post by:
Hi all, I have csv file which i want to show into datatable. when i try to use oledb to copy content of csv file into datatable not all rows are getting copied into datatable. Some last rows...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.