>>I have this LINQ statement which is not functioning as I expect:
>
>Not looked closely but how is it functioning? :-}
Once I pass any value in in either of the parameters I get all records coming out.
>
>>
>>
IQueryable<CustomerEntity> query = from customer in this.ObjectContext.CustomerEntitySet
>> where ((customerNumber != string.Empty ? customer.cus_number.Contains(customerNumber) : true)
>> && (customerLastName != string.Empty ? customer.cus_lastname.Contains(customerLastName) : true))
>> select customer;
>>
>>The logic I am trying to get is:
>>
>>Get all records where the customerNumber and customerLastName match.
>>
>>so If I have Cazabon, 0001 and Charles, 0002 as my records (Last Name, Number) and the user searches for z, 2, I should get no records back. If the y search for z, 1 then Cazabon, 0001 should return. If they search for just c, then both records should return.
>>
>>What is the correct way to do this?