I load a table from the db in a datatable belonging to a dataset. This db table has some constaints, so not any data can be inserted in it. but if i add some invalid data within the data开发者_JAVA百科table, when i do the "dataset.update()" operation an exception will be thrown, and any valid data inserted after in invalid rows will be lost.
Is there any way to test the inserted data, before commiting it to the db, so i could signalize the user that something's wrong with his data? Thanks!
I guess if you can enable constraints on your dataset, you will get error when inserting into dataset itself. So before reaching the actual DB, you will be able to catch the error.
Constraints are enforced on dataset when the System.Data.DataSet.EnforceConstraints
property of the DataSet is true.
Check this link for more details
精彩评论