IQueryable<customer_source> CustomerList = from a in (from p in db.job_info join c in db.customers on p.cust_num equals c.custno where p.status == 'A' orderby c.company select new { custno = c.custno, company = c.company } ).Distinct() orderby a.company select new customer_source { custno = a.custno, company = a.company };This way works, but it gives me anonymous types in my ListView, which I don't like (after your teaching).
var CustomerList = from a in (from p in db.job_info join c in db.customers on p.cust_num equals c.custno where p.status == 'A' orderby c.company select new { c.custno, c.company, c.phone, c.faxno } ).Distinct() orderby a.company select a;>You need to get away from var because it won't pass between classes.
> IEnumerable<customer> customers = from a in db.customers > where SqlMethods.Like(a.custno,CustomerFilter) || SqlMethods.Like(a.company,CustomerFilter) > orderby a.custno > select a; >>
> public class dataitem > { > public int custno { get; set; } > public string company { get; set; } > public string phone { get; set; } > public string faxno { get; set; } > > public dataitem(int cno, string c, string p, string f) > { > custno = cno; > company = c; > phone = p; > faxno = f; > } > } >>
> IEnumerable<dataitem> customers = from a in db.customers > where SqlMethods.Like(a.custno,CustomerFilter) || SqlMethods.Like(a.company,CustomerFilter) > orderby a.custno > select new dataitem(a.custno, a.company, a.phone, a.faxno) ; >