i having 2 datatables following records in dataset:
dtvariant:
name type status variant1 add active variant2 division active dtsubvariant:
name type subvariantname variant1 add sub1 variant1 add sub2 variant1 add sub3 variant2 division sub1 variant2 division sub2 variant2 division sub3 variant2 division sub4 now want subvariants list variant type , variants status active below:
add:sub1,sub2,sub3 division:sub1,sub2,sub3,sub4 here have build relationship between columns name , type between 2 datatables below:
ds1.relations.add("myrelation", dtvariant, dtsubvariant, false); query:
var data = (from c in ds1.tables["dtvariant"].asenumerable() .where c.field<string>("status")=="active" group c new { type = c.field<string>("type") } grp select new { type= grp.key.type, names= dp in c.getchildrows("myrelation")//not getting method }).tolist(); but when trying this:
from dp in c.getchildrows("myrelation") //i not getting getchildrows method. can me this??
var result = ds1.tables["dtsubvariant"].asenumerable() .groupby(i => i.type) .select(x=>new { type= i.key.type, subvariantlist=i.select(x=>x.subvariantname).toarray() }).tolist(); you have info in dtsubvariant, , can use query it.
Comments
Post a Comment