when u use the follow code on 1.1.it will compile without error.

Code
1
/**//**//**//// <summary>
2
/// Test table relation.
3
/// </summary>
4
public void Relation_1_1()
5

{
6
DataTable dtParent = this.CreateDataTable();
7
dtParent.TableName = "Parent";
8
9
DataRelation relations = ds.Relations.Add("Relation", dtParent.Columns["index"], dtParent.Columns["parent_index"], false);
10
11
this.builder.Append(" Get the data from tree ROOT.");
12
this.GetLayerFromParent(ds, relations);
13
this.PrintDataTable(ds.Tables["parent"]);
14
15
this.builder.Append(" Get the data from tree CHILDS.");
16
this.GetLayerFromChilds(ds, relations);
17
this.PrintDataTable(ds.Tables["parent"]);
18
19
this.DebugPrint(this.builder.ToString());
20
}
while it will run error on 2.0 with "Cannot create a DataRelation if Parent or Child Columns are not in a DataSet.".
if u want to run normally,u can use this cod:

Code
1
**/**///// <summary>
2
/// Test table relation.
3
/// </summary>
4
public void Relation_2_0()
5

{
6
DataTable dtParent = this.CreateDataTable();
7
dtParent.TableName = "Parent";
8
9
DataSet ds = new DataSet();
10
ds.Tables.Add(dtParent);
11
DataRelation relations = ds.Relations.Add("Relation", ds.Tables["Parent"].Columns["index"], ds.Tables["Parent"].Columns["parent_index"], false);
12
13
this.builder.Append(" Get the data from tree ROOT.");
14
this.GetLayerFromParent(ds, relations);
15
this.PrintDataTable(ds.Tables["parent"]);
16
17
this.builder.Append(" Get the data from tree CHILDS.");
18
this.GetLayerFromChilds(ds, relations);
19
this.PrintDataTable(ds.Tables["parent"]);
20
21
this.DebugPrint(this.builder.ToString());
22
23
//this.WriteToTxtFile(this.builder.ToString());
24
}