CompositeRowEditing
---------------------------------------------------------------
Demonstrates details of composite rows editing.

This sample depicts some details of composite rows
editing behavior.

Sample form (Form1) contains a viewset object (c1DataViewSet1) connected to 
the nwindDataSet1 typed DataSet object, with a single
c1DataView having the following definition:
"SELECT o.OrderID, o.CustomerID, od.* FROM Orders AS o 
  OUTER JOIN [Order Details] AS od"
, establishing a composite view with an outer join between the
"Orders" and "Order Details" tables.

Form1 also contains a DataGrid object (dataGrid1) on the left side of the 
form that is bound to this data view.

Two DataGrid(s) (dataGrid2 and dataGrid3) are bound to the
"Orders" and "Order Details" DataTables from the nwindDataSet1 
DataSet, i.e., to base tables on which the view is based.

The textBox1 control, located at the top of the form, shows the definition 
of the view and allows the user to change it by pressing the "Update Definition" 
button.

You can edit view rows and see how your changes
 are reflected on base DataTable rows, and vice versa - edit rows of the base
DataTable(s) and observe that view rows are changed accordingly.

Let's do the following actions with the view's rows:
- To view newly added rows, scroll all three grids to the bottom.
- Add a new row to the DataView grid, assign CustomerID with "ALFKI" and
  select another row to end editing of the newly added row.
- Observe that new row has been added to the "Orders" DataTable, but not to
  the "Order Details" DataTable. This is because you haven't assigned some
  column in a view row representing a column from the "Order Details" table in 
  conjunction with that OUTER JOIN. This means that
  the rows in the "Orders" DataTable which do not have child rows in the "Order Details"
  DataTable produce view rows nevertheless.
  Also note that the OrderID column of the new row has taken a value automatically,
  because this column is defined as AutoIncrement in nwindDataSet1.

- Now select the newly added row and assign some column representing a column
  from the "Order Details" DataTable. For example, set ProductID to 10, and end
  editing. Observe that the new row has been added to the "Order 
  Details" DataTable, with OrderID referencing the newly added row from the "Orders"
  DataTable.

- Add another row to the DataView's grid, and set its od_OrderId column (foreign key 
  of "Orders Details" DataTable referencing the "Orders" DataTable) to the same value 
  as in the previously added row. Next, assign ProductID column with 12, and end 
  editing. Observe that nothing has changed in the "Orders" DataTable, but a new row has been 
  added to the "Order Details" DataTable. Note that a new row has not been added to the "Orders" 
  DataTable because od_OrderId column has been assigned with a value referencing the 
  existing row from the "Orders" DataTable.

- Set the view's OrderId column value (primary key of "Orders" DataTable) in one of the 
  newly added rows to 20000. Observe that this value will be changed in the other view's 
  added row, as well as the values of OrderID columns in the corresponding rows of "Orders" and 
  "Order Details" DataTables.

Now let's modify the base DataTables and examine what happens
with DataView's rows.
- In the Orders DataTable grid change the value of the CustomerID column of the
  previously added row to "VINET", end editing and observe that this value has changed 
  in both corresponding rows of the DataView.

- In the [Order Details] DataTable grid delete one of the newly added rows
  and see that the corresponding composite row was deleted from view. Then delete
  the other newly added row and observe that the corresponding row has not
  disappeared from DataView, but the values of columns corresponding to the "Order Details"
  DataTable became null. This is because of the OUTER join.

- Now delete the row from the "Orders" DataTable and see that the corresponding row 
  disappeared from DataView.


INNER join

In the textbox containing the view definition statement, change the OUTER keyword to
INNER (to define an inner join) and press the "Update Definition" button to apply the 
changes.
Let's do the same operations as described above. You'll see a few changes
in it:
1) When you try to add a DataView row without assigning a column to correspond with 
a column from the "Order Details" DataTable, you'll get a constraint violation 
exception concerning the empty ProductID column. This occurs because, in the case 
of an inner join, a composite view row can only exist if it references rows from both base 
 DataTables. To satisfy this condition, the base DataTable rows for both tables are created 
forcibly (i.e., even if no view column corresponding to the certain DataTable was assigned, 
the row for that DataTable is created). When editing of the DataView row (and, 
as a consequence, editing of the base DataTable rows) is finished, the value of the 
"Order Details" ProductID column is null, which violates the "not-null" constraint for this
 column, so the expression is raised.

2) When you delete the last child row from "Order Details" DataTable for the 
specific parent row, a corresponding view row will be removed, regardless of the existence
of parent row from "Orders" DataTable.

