IEnumerable<customer_source> customers = from a in db.customers where SqlMethods.Like(a.custno, CustomerFilter) || SqlMethods.Like(a.company, CustomerFilter) orderby a.custno select a;not this "loosey-goosey, hey C# 3 has anonymous types that will get you in trouble" way:
var customers = from a in db.customers where SqlMethods.Like(a.custno, CustomerFilter) || SqlMethods.Like(a.company, CustomerFilter) orderby a.custno select new { a.custno, a.company, a.phone, a.faxno };>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) ; >