Question

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

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top