J
J
I'm experimenting with strongly typed datasets, and when the .Fill method is
called, the RowChanging fires for each row. This causes a problem when the
existing data does not adhere to the rules outlined in the RowChanging
method. Is there an easy way to not have the RowChanging event occur when
the dataset is being filled?
Example code is
daTitleAuthor.Fill(dsAuthors1);
private void tblTitleAuthor_RowChanging(object sender,
dsAuthors.titleauthorRowChangeEvent e) {
if ( !e.Row.IsroyaltyperNull() ) {
if ( (e.Action == DataRowAction.Add || e.Action == DataRowAction.Change)
&& e.Row.royaltyper > 10) {
throw new Exception("Royalty cannot be greater than 10");
}
}
}
called, the RowChanging fires for each row. This causes a problem when the
existing data does not adhere to the rules outlined in the RowChanging
method. Is there an easy way to not have the RowChanging event occur when
the dataset is being filled?
Example code is
daTitleAuthor.Fill(dsAuthors1);
private void tblTitleAuthor_RowChanging(object sender,
dsAuthors.titleauthorRowChangeEvent e) {
if ( !e.Row.IsroyaltyperNull() ) {
if ( (e.Action == DataRowAction.Add || e.Action == DataRowAction.Change)
&& e.Row.royaltyper > 10) {
throw new Exception("Royalty cannot be greater than 10");
}
}
}