FillError
FillErrorEventHandler FillError;
The FillError
event is raised when an error is
encountered during a Fill( )
operation.
The following code demonstrates how to handle the
FillError
event:
SqlDataAdapter da; // ... code to set up the data adapter da.FillError += new FillErrorEventHandler(da_FillError); DataSet ds = new DataSet(); da.Fill(ds); private void da_FillError(object sender, FillErrorEventArgs e); { MessageBox.Show("RowUpdating"); // continue the Fill with the rows remaining in the data source // despite the error e.Continue = true; }
The event handler receives an argument of type
FillErrorEventArgs
containing properties that
provide specific information about the event as described in Table 29-17.
This information can be used to handle the event appropriately and
determine if the Fill( )
operation should continue
processing the DataAdapter
Fill( )
operation. To continue processing, set the
Continue
property of the
FillErrorEventArgs
argument to
true
; this results in the Fill( )
operation resuming with the next row in the data source.
If an error is encountered while processing the Fill( )
operation, and the FillError( )
event
isn’t handled, an exception is raised.