Deleting rows which fail to meet constraints RRS feed

  • Question

  • Hi,

    I wish to fill a dataset table and to delete any rows that do not meet constraints. Here is an example of my code for doing this -

    catch (ConstraintException constraintException)
    if (this.rDS.testConf.HasErrors)
    foreach (rDDS.testConfRow testConfRow in this.rDS.testConf.GetErrors())


    If the Fill function finds an error row, will it continue to read in all the remaining rows anyway? If so, does the above code do what I wish it to do? Any other suggestions?


    Thursday, August 28, 2008 1:03 PM

All replies

  • Hi Barry,


    Yes Fill() will process all the rows and then throw the exception, the rows that have constraint errors will be marked with Error and you'll be able to get them with GetErrors().


    Remember that testConfRow.Delete() will mark the rows as deleted, if you need to remove them call AcceptChanges().


    Let me know if this helps. Best Regards


    Thursday, September 11, 2008 1:50 AM