[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 590
  • Last Modified:

How do I AcceptChanges to DataSet when there are Rows with RowState of Detached?

Using .Net 1.1
I have a DataSet and have subscribed to the RowChanged event. When this row fires, I reject some rows under certain conditions. The rows are rejected using the e.Rows.RejectChanges() method. I have also tried e.Row.Delete() method. Problem is, it leaves these rows in the Row Collection with a RowState of detached. When I attempt to use the AcceptChanges() method, the RowNotInTableException is thrown. Any suggestions what I can do?
0
freename
Asked:
freename
  • 2
  • 2
1 Solution
 
Bob LearnedCommented:
What happened with 'e.Rows.RejectChanges'?
0
 
freenameAuthor Commented:
The LearnedONe,
It appears to reject the changes. However, when I look at the RowsCollection, it is still there. Its RowState is detached. Thus the problem when I do AcceptChanges().
0
 
Bob LearnedCommented:
If you left out the call to AcceptChanges, what happens after that step?  Are you writing the changes back to the database?
0
 
freenameAuthor Commented:
No longer need solution. Accepting this one since TheLearnedOne is the only one to answer.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now