Edit data and save back to database
I just need to edi开发者_如何学JAVAt one field on a datarow and save the changes back to the database. My database is SQL Compact 3.5
I tried many methods but change is not saved to database. Could you give me code example please?
Please help.
Me.taSet.Fill(Me.Dsset.tblQuestions)
Dsset.tblQuestions.Rows(1).BeginEdit()
Dsset.tblQuestions.Rows(1).Item("ExamID") = "EDITED"
Dsset.tblQuestions.Rows(1).AcceptChanges()
taSet.Update(Dsset.tblQuestions)
Remove the following line from your code :
Dsset.tblQuestions.Rows(1).AcceptChanges()
When you call AcceptChanges()
, you mark that row as clean (which means this row has not been edited). That is why it does not get upodated.
精彩评论