M
mathieu
what's wrong with this code?
I get a null Reference exception on the childrelation line.
Can i make a childRelation on the same table. Say for instance link
together all child segment of a parent?
public class DataTableSegment : DataTable
{
public DataTableSegment():base()
{
Columns.AddRange(new DataColumn[]
{
new DataColumn("IdSegment", typeof(System.Int32)),
new DataColumn("IdNiveau", typeof(System.Int32)),
new DataColumn("IdPere", typeof(System.Int32)),
new DataColumn("IdFrere", typeof(System.Int32)),
new DataColumn("Type", typeof(System.Byte)),
new DataColumn("Nom", typeof(System.String)),
}
);
Columns[0].Unique = true;
PrimaryKey = new DataColumn[]{ Columns[0] };
//bug ?? null reference exception
ChildRelations.Add(new DataRelation("parent-child",
this.Columns[0],
this.Columns[2], false));
}
I get a null Reference exception on the childrelation line.
Can i make a childRelation on the same table. Say for instance link
together all child segment of a parent?
public class DataTableSegment : DataTable
{
public DataTableSegment():base()
{
Columns.AddRange(new DataColumn[]
{
new DataColumn("IdSegment", typeof(System.Int32)),
new DataColumn("IdNiveau", typeof(System.Int32)),
new DataColumn("IdPere", typeof(System.Int32)),
new DataColumn("IdFrere", typeof(System.Int32)),
new DataColumn("Type", typeof(System.Byte)),
new DataColumn("Nom", typeof(System.String)),
}
);
Columns[0].Unique = true;
PrimaryKey = new DataColumn[]{ Columns[0] };
//bug ?? null reference exception
ChildRelations.Add(new DataRelation("parent-child",
this.Columns[0],
this.Columns[2], false));
}