473,657 Members | 2,507 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataRow.AcceptC hanges 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).D elete();

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

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

The row has been deleted. Call DataRow.AcceptC hanges() 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).D elete();

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

Why does this happen if the DataRow.Delete method page on msdn says that you
need to call DataRow.AcceptC hanges() 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
2007
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 than I was before. I'm basicly taking date from some text boxes, trying to put them into a datarow and using that datarow to update the database, but its not working. The btn_update is where I am sending the information back to the addclient...
0
935
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 databaseengine class i created, theDataStore is a dataset that gets loaded from a xml data file when the constructor runs. the database engine sits in a application variable within a IIS application and only one copy ever
6
5998
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 instance of the row, but aren't linked to the table. Is that why it doesn't update? If not, what is missing? Please help!!! Dim da As New SqlDataAdapter("select * from Table1", cn)
1
2463
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 As DataRow myDataRow = dtRemark.DefaultView.Item(0).Row dtRemark.Rows.Remove(myDataRow) dtRemark.acceptchanges() dsRemark.update()
5
3104
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 the row. The Delete method marks the row as Deleted in the DataSet or DataTable but does not remove it. Instead when the DataAdapter encounters a row marked as Deleted, it executes its DeleteCommand method to delete the row at the data source. The...
2
1988
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 column named *Quantity* in a database table also gets updated with the changes made by the user. The Form has a Label as well which shows the total cost of all the items that are currently present in his cart. This the OnUpdateCommand event...
3
2940
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 Sub save_changes(ByVal _infraction_id As System.Guid)
6
5377
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 mydr.acceptchanges()
1
3005
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 AcceptChanges method for the DataTable object." But what about the other way around? If I call EndEdit is AcceptChanges invoked? Since trying some test code, it seems to be that way. I am still trying to
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7324
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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 we have to send another system
2
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1611
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.