Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
880
Which event is best to autosave data
posted

Hello:

I would like to commit changes to the database, if any, when the row changes.

I was issuing a dataset.Update() on the BeforeRowDeactivate event. But if some of the data integrity rules is not obeyed (for example, first name cannot be null), it throws an exception.

So, is there another event that I can use to implement this requirement?

Venki

Parents
  • 69832
    Offline posted

    It sounds like the problem is not knowing when to update, but how to enforce your data integrity rules. You can set the AllowDbNull property on the DataColumn to false so that an error will be raised when the user tries to exit edit mode on that cell with a null value. You can also handle BeforeExitEditMode an enforce any kind of rule you like, setting the Cancel property of the event args to true if some criteria is not met.

Reply Children