您好,我正在尝试将 gridview 与数据库中的不同行绑定。我希望在 JobID 列上实现 distict。请帮忙
using (ATPDataContext at = new ATPDataContext())
{
var qryPartnerJobs = (from pj in at.jobs
join jq in at.job_quotes on pj.JobID equals jq.JobID
join u in at.users on jq.TradeUserID equals u.UserID
where pj.IsApproved == true
select new
{
JobID = pj.JobID,
FirstName = u.FirstName,
ServiceName = pj.service.ServiceName,
ServiceTypeName = pj.service_type.ServiceTypeName,
IsApproved = pj.IsApproved,
IsActive = pj.IsActive,
IsQuoted = pj.IsQuoted,
IsAssigned = pj.IsAssigned,
ApprovalDate = pj.ApprovalDate,
Description = pj.Description
}).Distinct();
gvPartnerJob.DataSource = qryPartnerJobs;
gvPartnerJob.DataBind();
}