I want to make a selection from a DataTable using the Select method with the
criteria including a nested parent field. Both of these works fine
(Northwind data):

DataRow[] drs =
ds.Tables["OrderDetails"].Select("Parent(Orders2Details).ShipName LIKE
'A%'");
DataRow[] drs =
ds.Tables["Orders"].Select("Parent(Customers2Orders).CompanyName LIKE
'A%'");

But when I try to...

DataRow[] drs =
ds.Tables["OrderDetails"].Select("Parent(Orders2Details).Parent(Customers2Or
ders).CompanyName LIKE 'A%'");

...it doesn't work! I've looked everywhere without finding any clue on how
the syntax for a nested parent reference would look. Any input would be
appreciated!

Re: DataTable.Select with nested Parent fields by Miha

Miha
Fri Feb 20 05:40:15 CST 2004

Hi Chris,

Yes, nested relations doesn't work.
Workaround: create an additional column (in table Orders) details that holds
(Expression property) second level relation
(Parent(Customers2Orders).CompanyName ).

HTH,
--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Chris Forsberg [MVP]" <chris.forsberg@newsgroup> wrote in message
news:uG48cS69DHA.1428@TK2MSFTNGP12.phx.gbl...
> I want to make a selection from a DataTable using the Select method with
the
> criteria including a nested parent field. Both of these works fine
> (Northwind data):
>
> DataRow[] drs =
> ds.Tables["OrderDetails"].Select("Parent(Orders2Details).ShipName LIKE
> 'A%'");
> DataRow[] drs =
> ds.Tables["Orders"].Select("Parent(Customers2Orders).CompanyName LIKE
> 'A%'");
>
> But when I try to...
>
> DataRow[] drs =
>
ds.Tables["OrderDetails"].Select("Parent(Orders2Details).Parent(Customers2Or
> ders).CompanyName LIKE 'A%'");
>
> ...it doesn't work! I've looked everywhere without finding any clue on how
> the syntax for a nested parent reference would look. Any input would be
> appreciated!
>
>



Re: DataTable.Select with nested Parent fields by Chris

Chris
Fri Feb 20 05:54:53 CST 2004

Ok, thanks Miha!

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:ef2FNZ69DHA.2804@TK2MSFTNGP09.phx.gbl...
> Hi Chris,
>
> Yes, nested relations doesn't work.
> Workaround: create an additional column (in table Orders) details that
holds
> (Expression property) second level relation
> (Parent(Customers2Orders).CompanyName ).
>
> HTH,
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & software development
> miha at rthand com
> www.rthand.com
>
> "Chris Forsberg [MVP]" <chris.forsberg@newsgroup> wrote in message
> news:uG48cS69DHA.1428@TK2MSFTNGP12.phx.gbl...
> > I want to make a selection from a DataTable using the Select method with
> the
> > criteria including a nested parent field. Both of these works fine
> > (Northwind data):
> >
> > DataRow[] drs =
> > ds.Tables["OrderDetails"].Select("Parent(Orders2Details).ShipName LIKE
> > 'A%'");
> > DataRow[] drs =
> > ds.Tables["Orders"].Select("Parent(Customers2Orders).CompanyName LIKE
> > 'A%'");
> >
> > But when I try to...
> >
> > DataRow[] drs =
> >
>
ds.Tables["OrderDetails"].Select("Parent(Orders2Details).Parent(Customers2Or
> > ders).CompanyName LIKE 'A%'");
> >
> > ...it doesn't work! I've looked everywhere without finding any clue on
how
> > the syntax for a nested parent reference would look. Any input would be
> > appreciated!
> >
> >
>
>