i have follow question on question asked here
here of linq query
this query 1:
var rcode = in dbentity.mobileassetdowntimereasoncodes a.mobileassetcategoryid.equals(reasoncode) select new { a.jdereasoncode }; reasoncode.datasource = rcode.tolist(); reasoncode.databind();
this brings resulting codes displayed in datagrid.
here query 2 works
var rjdereasoncode = in jdetable.f0005 a.drsy.equals("00") && a.drdl01 != null && (a.drrt.equals("w4") || a.drrt.equals("w5")) && a.drky.trim() == "801" select new { category_code = a.drrt, reason_code = a.drky, description = a.drdl01 };
but instead of hardcoding "801" want pass result of query1 query 2 , display query 2 results in datagrid. how do ?
something this?
list<string> rcode = dbentity.mobileassetdowntimereasoncodes .where(a=>a.mobileassetcategoryid.equals(reasoncode)) .select(a=>a.jdereasoncode).tolist(); var rjdereasoncode = jdetable.f0005 .where(a=>a.drsy.equals("00") && a.drdl01 != null && (a.drrt.equals("w4") || a.drrt.equals("w5")) && rcode.any(code => code.contains(a.drky.trim()))) .select(a=>new { category_code = a.drrt, reason_code = a.drky, description = a.drdl01 });
uses enumerable.any method check if retrieved rcodes 1 of codes in f0005 table.
Comments
Post a Comment