See my comments in line below.
>I'm thinking I programmed everything wrong. Obviously Biz object should be able itself to delete order and its details. Also in the way I implemented it now everything seems to be coupled - interface should not go through details of accessing DataSet row and passing PK, I think.
>
>Let me first understand how should I have programmed it and then try to fix the problem.
>
>In the meantime, this is the whole Order Biz>
Well sort of. You could have the Orders Biz obj to participate in the delete of the line items. You might consider having a method for deleting orders in your orders business object where you pass in a boolean parameter to also delete any order items. This way it refuse to delete orders if it contains line items or if you pass in true, it would delete line items also. To delete line items, your orders business object would call a method on the line items business object to delete all order line items with the specified order ID. I probably wouldn't actually delete line items from within the orders biz obj itself. Maybe something like below code.
public int DeleteOrders(int orderID, bool deleteLineItems)
{
bool llSuccess = true;
if (deleteLineItems)
{
LineItemsBizObj oLineItems = new LineItemsBizObj();
oLineItems.DeleteRowsByOrderID(orderID);
}
else
{
}
if (llSuccess)
}
>the _dtSearch is a form's property
>
>// Used for search results
> private OrdersDataSet.OrdersDataTable _dtOrderSearch = new OrdersDataSet.OrdersDataTable();
>
>and the DataGrid uses it as its source.
Then as I mentioned, this is why you were seeing the rows disappear in the grid, but you were not actually deleting the data in the back end.
You would need to delete the order via the business object as I stated above.
>>
>>Is _itemBiz.DeleteItemsByOrderKey a method on a business object? Why not use the same methodology for deleting the actual order as well. Also, you should verify the line items were deleted before attempting to delete the actual order. What is _dtOrderSearch? If this is a grid, then that explains why you are seeing the order disappear in the grid but not deleted in the data.
>>Tim
Timothy Bryan