473,323 Members | 1,622 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,323 software developers and data experts.

BindingSource determine changes before calling EndEdit()

How do I determine if there are any rows within the BindingSource that have
changed prior to calling the EndEdit(). I need to do this in order to
archive some records and if I call the EndEdit() then it also wipes out the
orginal version of the dataset record with the proposed changes., However I
don't wish to iterate through every row in the dataset in order to figure
out changes, Does the BindingSource not have something similar to the
GetChanges() or HasChanges()

Thanks in advance.
Mar 29 '07 #1
2 11830
EndEdit does not wipe out the original version of the data in the dataset.
I think it pushes it from the control into the underlying dataset, which is
what you want, so you can look for teh differences. (If I'm wrong, I'm sure
someone will correct me.)

In a dataset, to see the rows that have changed, you can check the version
of the data using the DataViewRowState enumeration.

This shows the rows modified, with the new value:

DataViewRowState dvrs;
dvrs = DataViewRowState.ModifiedCurrent;
Console.WriteLine("Modified Rows");
//first param is filter, 2nd is sort, 3rd is recordstates
foreach (DataRow row in dt.Select("", "", dvrs))
Console.WriteLine(" {0}", row["CompanyName", DataRowVersion.Original]);
(I may have messed up my parentheses and square brackets there; I converted
this from a VB sample that I have.)

Robin S.
----------------------------------
"Rob Dob" <ro************@yahoo.comwrote in message
news:uU**************@TK2MSFTNGP04.phx.gbl...
How do I determine if there are any rows within the BindingSource that
have changed prior to calling the EndEdit(). I need to do this in order
to archive some records and if I call the EndEdit() then it also wipes
out the orginal version of the dataset record with the proposed changes.,
However I don't wish to iterate through every row in the dataset in order
to figure out changes, Does the BindingSource not have something similar
to the GetChanges() or HasChanges()

Thanks in advance.


Mar 29 '07 #2
Dealing strictly with a BindingSource (and no specific implementations
such as DataSet) then perhaps monitor the ListChanged event,
specifically for ItemChanged types, and keep track of which entities
have been tweaked? To save on the complexities of tracking their
offsets during complex changes / resets, I'd just track the actual
object reference (rather than offsets at the time of the change).

Just a thought.

Marc

Mar 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Allan Bredahl | last post by:
Hi All I have a bit of a problem with using a datarow to store data that is show in a form. On form load I set the Value/Text properties of my form elements to the specific Column values of...
2
by: Gav | last post by:
Hi all, I have a Datagrid and a save button if I change a value in a cell in the datagrid and hit the save button, it does not write the new value into the database. If I move the focus away...
6
by: jchao123 | last post by:
Dear All, I have an MDB file (Access 2000/XP) which contains generic routines I use in various apps (eg, API calls, File access classes etc). I have compiled into an MDE file which I reference...
3
by: acg | last post by:
If you have a class with a public method, and another class which will want to call this method, is there a way to determine the type of the calling class within the method being called? For I...
6
by: John | last post by:
Hi How can I move from one aspx page to another programmatically? Thanks Regards
3
by: Dean Slindee | last post by:
I have a exception handling class that could be called from either a windows project app or a console project app. Is there any way for this class to determine which type of app called it without...
1
by: Peter K | last post by:
Hi is there a way to determine "the calling type" in c#? I have found several places on the web with examples using StackTrace, and just as many rebuttals of the presented method - stating...
5
by: =?Utf-8?B?U2llZ2ZyaWVkIEhlaW50emU=?= | last post by:
I need to redundantly write C++ and C# programs to (1) determine the input language (german, french, english...) (2) determine changes in the input language (preferably a delegate rather than...
1
by: Marc | last post by:
I found this in MSDN: "The BeginEdit method is called implicitly when the user changes the value of a data-bound control; the EndEdit method is called implicitly when you invoke the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.