Y
Yury Romanov
Hello,
DataTable.Select( sFilter ) crashes with "Index was outside the bounds of
the array" exception when:
1. parent table has more columns than child one
2. filter expression apllied to child table addresses to parent column which
has higher order number than columns count in child table.
Repro code snippet:
DataSet ds = new DataSet();
DataTable dtMain = ds.Tables.Add("MAIN_TBL");
DataTable dtChild = ds.Tables.Add("CHILD_TBL");
DataColumn dcMainPK = dtMain.Columns.Add("ID");
dtMain.Columns.Add("NAME");
DataColumn dcChildFK = dtChild.Columns.Add("FK");
DataRelation rel = new DataRelation("testrelation", dcMainPK, dcChildFK );
ds.Relations.Add( rel );
DataRow[] rows = dtChild.Select("Parent.NAME='testname'");
DataTable.Select( sFilter ) crashes with "Index was outside the bounds of
the array" exception when:
1. parent table has more columns than child one
2. filter expression apllied to child table addresses to parent column which
has higher order number than columns count in child table.
Repro code snippet:
DataSet ds = new DataSet();
DataTable dtMain = ds.Tables.Add("MAIN_TBL");
DataTable dtChild = ds.Tables.Add("CHILD_TBL");
DataColumn dcMainPK = dtMain.Columns.Add("ID");
dtMain.Columns.Add("NAME");
DataColumn dcChildFK = dtChild.Columns.Add("FK");
DataRelation rel = new DataRelation("testrelation", dcMainPK, dcChildFK );
ds.Relations.Add( rel );
DataRow[] rows = dtChild.Select("Parent.NAME='testname'");