locked
linq to sql queries RRS feed

  • Question

  • hey guys,

    i've been working on creating a search invoving multiple parameters, and im doing something like this

     

    DataClasses1DataContext db = new DataClasses1DataContext();

    List<DataLogsReport> value = new List<DataLogsReport>();

    HashSet<DataLogsReport> C_value = new HashSet<DataLogsReport>(value);var matchingCustomers0 = from cust in db.DataLogsReports

     

    select cust;

    C_value.UnionWith(matchingCustomers0);

     

    if (!string.IsNullOrEmpty(SearchList[0]))

    {

    var matchingCustomers = from cust in db.DataLogsReports

    where (cust.StationID.StartsWith(SearchList[0]))

    select cust;

     

    C_value.IntersectWith(matchingCustomers);

    }

    if (!string.IsNullOrEmpty(SearchList[1]))

    {

    var matchingCustomers2 = from cust in db.DataLogsReports

    where (cust.CardID.StartsWith(SearchList[1]))

    select cust;

     

     

    C_value.IntersectWith(matchingCustomers2);

    }

     

     

    return C_value.ToList();

     

    my question is, since my "matchingcustomer" variable is not juz a simple string, ut a list with multiple fields, how does IntersectWith work when C_value.IntersectWith(matchingCustomers2); is called? which field does it compare to return results? cos all im getting now are Null results...

    Thursday, April 9, 2009 3:15 AM

Answers

  • I'd take this question over to the LINQ MSDN forums as you'll get better answers there.

    Friday, April 10, 2009 4:11 AM