468,720 Members | 1,633 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,720 developers. It's quick & easy.

DataRow.AcceptChanges is useless?

I have the following code:

//delete the row in the table that has ID of 1. This line works fine.
DataSet.Table["Start"].Rows.Find(1).Delete();

//Accept the delete changes to the table. This row returns 'object set to a
null reference' exception. Why?
DataSet.Tables["Start"].Rows.Find(1).AcceptChanges();

Why does this happen if the DataRow.Delete method page on msdn says that you
need to call DataRow.AcceptChanges() after a delete to make the rows
actually delete?
Jun 27 '08 #1
1 2100
Simply call Dataset.Tables("Start").AcceptChanges()

The row has been deleted. Call DataRow.AcceptChanges() when you update or
add new record to a datarow.
--
Okoronkwo Chinedu
Crazy About Learning
"Andy B" wrote:
I have the following code:

//delete the row in the table that has ID of 1. This line works fine.
DataSet.Table["Start"].Rows.Find(1).Delete();

//Accept the delete changes to the table. This row returns 'object set to a
null reference' exception. Why?
DataSet.Tables["Start"].Rows.Find(1).AcceptChanges();

Why does this happen if the DataRow.Delete method page on msdn says that you
need to call DataRow.AcceptChanges() after a delete to make the rows
actually delete?
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by CaptRR | last post: by
reply views Thread by jack | last post: by
6 posts views Thread by Wanda | last post: by
1 post views Thread by Agnes | last post: by
5 posts views Thread by rn5a | last post: by
2 posts views Thread by rn5a | last post: by
3 posts views Thread by C a r l o s A n t o n i o | last post: by
6 posts views Thread by cj | last post: by
1 post views Thread by Marc | last post: by
1 post views Thread by CARIGAR | last post: by
9 posts views Thread by bryonone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.