I'm using LINQ to query data. Consider a case where the user only wants to report on say 1 of the 3 fields? (see below)
Can anyone tell me how to build the query dynamically?
Thanks
DD
var query =
from cl in db.tblClaims
join cs in db.tblCases
on cl.ref_no equals cs.ref_no
where cl.claim_status == "Appeal"
&& cl.appeal_date >= Convert.ToDateTime(txtReferedFromDate.Text)
&& cl.appeal_date <= Convert.ToDateTime(txtReferedToDate.Text)
&& cs.referred_from_lho == dlLHO.Text
&& cs.adviser == dlAdviser.Text
select new
{
Ref = cs.ref_no,
ClaimType = cl.claim_type,
ClaimStatus = cl.claim_status,
AppealDate = cl.appeal_date
};
gvReport.DataSource = query;