PC Review


Reply
Thread Tools Rate Thread

BindingSource determine changes before calling EndEdit()

 
 
Rob Dob
Guest
Posts: n/a
 
      29th Mar 2007
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.


 
Reply With Quote
 
 
 
 
RobinS
Guest
Posts: n/a
 
      29th Mar 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
Marc Gravell
Guest
Posts: n/a
 
      29th Mar 2007
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

 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BindingSource.EndEdit() throws Exception Aaron Microsoft ADO .NET 2 20th Jun 2008 02:01 PM
BindingSource.EndEdit doesn't work with FormClosing Evan M. Microsoft Dot NET Framework Forms 2 17th Dec 2007 07:10 PM
BindingSource.EndEdit and Position =?iso-8859-1?Q?Samuel_Garc=EDa?= Microsoft ADO .NET 0 3rd Nov 2007 08:11 PM
BindingSource determine changes before calling EndEdit() Rob Dob Microsoft Dot NET Framework Forms 2 29th Mar 2007 05:16 AM
BindingSource.EndEdit - Not updating underlying data source Dustin Davis Microsoft ADO .NET 12 5th Jan 2007 05:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:57 AM.