M
mathieu
I have a class deriving from datatable. In ctor i define the columns
and set the pk. And there it crashes on the unique = true line.
public DTNomenclatureLevel() : DataTable
{
try
{
Columns.Clear();
base.Columns.AddRange(new DataColumn[] {new DataColumn("Id",
System.Type.GetType("System.Int32")), new DataColumn("Lib",
System.Type.GetType("System.String"))} );
//PK (Id)
base.Columns[0].Unique = true;
base.PrimaryKey = new DataColumn[]{base.Columns[0]};
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}
}
What is strange is that it's was working well up to this morning ???
here is the error message:
System.Object {System.NullReferenceException} System.Object
StackTrace " at System.Data.DataTable.GetIndex(Int32[] indexDesc,
DataViewRowState recordStates, IFilter rowFilter)\r\n at
System.Data.DataColumn.get_SortIndex()\r\n at
System.Data.DataColumn.CheckUnique()\r\n at
System.Data.DataColumn.set_Unique(Boolean value)\r\n at
TNS.AdRequest.Core.DTNomenclatureLevel..ctor
Anyone have a clue?
thanks
mat
and set the pk. And there it crashes on the unique = true line.
public DTNomenclatureLevel() : DataTable
{
try
{
Columns.Clear();
base.Columns.AddRange(new DataColumn[] {new DataColumn("Id",
System.Type.GetType("System.Int32")), new DataColumn("Lib",
System.Type.GetType("System.String"))} );
//PK (Id)
base.Columns[0].Unique = true;
base.PrimaryKey = new DataColumn[]{base.Columns[0]};
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}
}
What is strange is that it's was working well up to this morning ???
here is the error message:
System.Object {System.NullReferenceException} System.Object
StackTrace " at System.Data.DataTable.GetIndex(Int32[] indexDesc,
DataViewRowState recordStates, IFilter rowFilter)\r\n at
System.Data.DataColumn.get_SortIndex()\r\n at
System.Data.DataColumn.CheckUnique()\r\n at
System.Data.DataColumn.set_Unique(Boolean value)\r\n at
TNS.AdRequest.Core.DTNomenclatureLevel..ctor
Anyone have a clue?
thanks
mat