private void MakeSecondChildTable()
{
// Create a new Table
_secondChildTable = new DataTable("SecondChildTable");
DataColumn column;
DataRow row;
// Create first column and add to the DataTable.
column = new DataColumn();
column.DataType = typeof(int);
column.ColumnName = "ChildID";
column.AutoIncrement = true;
column.Caption = "ID";
column.ReadOnly = true;
column.Unique = true;
// Add the column to the DataColumnCollection.
_secondChildTable.Columns.Add(column);
// Create second column.
column = new DataColumn();
column.DataType = typeof(string);
column.ColumnName = "ChildItem";
column.AutoIncrement = false;
column.Caption = "ChildItem";
column.ReadOnly = false;
column.Unique = false;
_secondChildTable.Columns.Add(column);
//Create third column.
column = new DataColumn();
column.DataType = typeof(int);
column.ColumnName = "ParentID";
column.AutoIncrement = false;
column.Caption = "ParentID";
column.ReadOnly = false;
column.Unique = false;
_secondChildTable.Columns.Add(column);
//Create fourth column.
column = new DataColumn();
column.DataType = typeof(int);
column.ColumnName = "DepartmentID";
column.Caption = "DepartmentID";
column.Unique = false;
_secondChildTable.Columns.Add(column);
_dataSet.Tables.Add(_secondChildTable);
// Create three sets of DataRow objects,
// five rows each, and add to DataTable.
for (int i = 0; i <= 1; i++)
{
row = _secondChildTable.NewRow();
row["childID"] = i + 1;
row["ChildItem"] = "SecondChildItem " + (i + 1);
row["ParentID"] = 1;
row["DepartmentID"] = 1;
_secondChildTable.Rows.Add(row);
}
for (int i = 0; i <= 1; i++)
{
row = _secondChildTable.NewRow();
row["childID"] = i + 5;
row["ChildItem"] = "SecondChildItem " + (i + 1);
row["ParentID"] = 2;
row["DepartmentID"] = 2;
_secondChildTable.Rows.Add(row);
}
for (int i = 0; i <= 1; i++)
{
row = _secondChildTable.NewRow();
row["childID"] = i + 10;
row["ChildItem"] = "SecondChildItem " + (i + 1);
row["ParentID"] = 3;
row["DepartmentID"] = 3;
_secondChildTable.Rows.Add(row);
}
}