Validating data, Visual Basic, VS2005
Posted on 2007-07-20
Visual Basic, VS2005
How do I validate the data in a table before updating to the database.
Here's the situation:
Using a binding navigator and strongly type datasets, with a form that will load from 1 to N records, a user is able to make changes on any record by scrolling with the binding navigator. When they press save, I want to evaluate certain columns in the table, throw an error, have the form return to the offending record, and positon at the offending field.
This sounds simple enough but I've been struggling for several days trying to ascertain the techniques that i'm supposed to be employing. Is my strategy of validating the table before the .Update off base? Am I supposed to be checking before they scroll from the record? How are either of those strategies expressed in code? For example, how do I repostion the form to the record that generated the error? How do i cancel a move next or move previous if there is an error on the current record? (For that matter, does the move forward or prevous click even happen before or after the record has moved?)
Despite hours of searching, I've been unable to locate any decent documention on exactly how all of these new constructs are supposed to be employed in real-life, data driven applications. At the very least I need references to documentation that is demonstrating practical examples. (Not the tripe that passes for coding examples in some of the MS documentation.)