473,503 Members | 5,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2410
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1999
by: CaptRR | last post by:
I think this is the right group to post to, so here goes. My problem is this, I cannot update the datarow to save my life. Been on this for 2 days now, and still am no closer to figuring it out...
0
919
by: jack | last post by:
using the following code, I've been unable to write an updated xml document.I can see the xml file get refreshed but even at that, it writes in the original contents. these procs come from a...
6
5989
by: Wanda | last post by:
Hello, I tried to update a row in a table by using the datarow and data adapter. Unfortunately, it doesn't update. I try finding that datarow and set it to "dr", I can see dr could be just an...
1
2456
by: Agnes | last post by:
My code is so simple that I want to remove the row. However, After process the below code, I browse the table, nothing is deleted. dtRemark.DefaultView.RowFilter = "cocode ='ABC'" Dim myDataRow...
5
3099
by: rn5a | last post by:
The .NET 2.0 documentation states the following: When using a DataSet or DataTable in conjunction with a DataAdapter & a relational data source, use the Delete method of the DataRow to remove...
2
1978
by: rn5a | last post by:
When a DataGrid is in the editable mode, users can change the quantity of the items that are currently in his shopping cart by entering a new quantity in a TextBox. After changing the quantity, a...
3
2934
by: C a r l o s A n t o n i o | last post by:
Hello, How can I update a datarow in a typed dataset? It seems i can't make it to write the changes into the database. What am i doing wrong? Thanks in advance. Here's my code: Private...
6
5311
by: cj | last post by:
If I'm sitting on a datarow for a customer and want to change his phone number only if it's blank what would I write? if myDr("phone")= "" then myDr("phone") = "mphone" endif...
1
2991
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
7063
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6970
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7441
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1489
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.