Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataSet.AcceptChanges() is not working

In my application the following code not saving the data back to the database

this.lMSData.publisher.AddpublisherRow(txtname.Text, txtcondact.Text, txtmobile.Text);
this.lMSData.publisher.AcceptChanges();

I also used lmsData.AcceptChanges().. but its not worked, i noticed that i can update and delete the rows and save back to the database without any errors. but i cant add the data

like image 981
Binson Eldhose Avatar asked Jan 27 '26 23:01

Binson Eldhose


1 Answers

AcceptChanges does not save data back to the database - to do that, you need to call the update method on your tableadapter/dataadapter. Datasets are 'rollbackable'. All the changes you make can be reversed by calling RejectChanges, (whereupon any Added rows will be removed, and rows marked Modified or Deleted will be returned to how they were); or committed by calling AceptChanges, whereupon the new data becomes the current data. The data is still only in the dataset at this point though - until you call Update.

like image 63
peterG Avatar answered Jan 31 '26 05:01

peterG



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!