PC Review


Reply
Thread Tools Rate Thread

Is this a DataSet Row.RejectChanges() BUG ?

 
 
Ciaran
Guest
Posts: n/a
 
      16th Jul 2004
Hi all,

I am encountering a strange problem with the DataSet Row.RejectChanges().

I'm populating a grid from a DataSet. The idea is that if the user
checks a cell the row in the dataset is updated. If the user unchecks
the row the row update is undone (row.rejectchanges) in the dataset.

My problem is as follows:

1. 5 Items in Grid...Check all 5. RowState = Modified
2. Uncheck 3 of these 5 items. RowState = Unchanged for 3 items and
Modified for 2 items. (As expected).
3. Call sqlAdapter.Update(tableIems). 4 Items have their RowState
set to Modified, not 3 items. If I check the DataSet one of the
items which originally had it's RowState = Unchanged now has
RowState = Modified.

My understanding is that Row.RejectChanges() will reject the changes to
that row since the last time AcceptChanges() was called. In this case
AcceptChanges() is called for sqlAdapter.Update() and at not time before
this.

Here is a editied snippet of my code ...

if (this.gridProducts[cell.RowNumber,cell.ColumnNumber].ToString() == CHECKED)
this.MarkItemAsChecked();
else
this.MarkItemAsUnChecked();


protected void MarkItemAsChecked()
{
DataRow row = (this.gridProducts.DataSource as DataTable).Rows.Find(ID);
row.BeginEdit();
row[0] = "SomeValue";
row.EndEdit();
}

protected void MarkItemAsUnChecked()
{
DataRow row = (this.gridProducts.DataSource as DataTable).Rows.Find(ID);
row.RejectChanges();
}
 
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
DS.RejectChanges =?Utf-8?B?QW50?= Microsoft ADO .NET 4 13th Nov 2006 01:51 PM
AcceptChanges and rejectchanges Victor Microsoft Dot NET Compact Framework 1 16th Mar 2005 08:06 PM
Dataset Update / AcceptChange / RejectChanges TheNortonZ Microsoft ADO .NET 2 8th Nov 2004 03:52 PM
DataSet.RejectChanges() doesn't work! Saso Zagoranski Microsoft C# .NET 2 17th Nov 2003 08:18 AM
RejectChanges on Added Row... Rui Fortes Microsoft ADO .NET 0 20th Oct 2003 12:58 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:02 AM.