Auto-incrementing on a filtered table RRS feed

  • Question

  • I'm working on a VB.NET application with multiple bindingsources related by foreign keys. The top level datatable needs to be filtered based on data in a lower level table. For example, to use the Northwind idiom, I want all Orders such that there exists at least one corresponding OrderDetails row where the UnitPrice is greater than $1. This filtering is being done at the TableAdapter level.

    The problem is when adding a new Order, the auto-incremented ID can be set to the ID of an existing Order that was filtered out previously. So then all the OrderDetails for that existing Order are immediately in the OrderDetails DataGridView.

    I think it the IDs would come out right if I did the filtering at the BindingSource level, but where clause appears to be too complicated for that. Is there any way to change the filtering or the ID auto-incrementing such that it will give the right value?
    • Moved by VMazurModerator Wednesday, February 3, 2010 11:35 AM (From:ADO.NET Data Providers)
    Wednesday, January 27, 2010 11:54 PM