July 2002
Beginner
720 pages
14h 35m
English
The DataAdapter class throws generic exceptions when problems occur. To obtain a descriptive error message for each fault in a row and column in any table in a DataSet, we use the following technique.
Check the HasError property to see if any of the tables in the DataSet contain errors.
If no errors are detected in the DataSet, we can safely proceed with the Update.
If errors are detected in the DataSet, we use the GetErrors method to obtain the rows that contain the errors.
Once we have determined which rows contain the errors, we use the GetColumnError(DataColumn ) method to determine the incorrect columns for each row with errors.
The following example illustrates the technique described above:
If (Not DS.HasErrors) ...
Read now
Unlock full access