LINQ Query problem

I have a LINK Query, it is suppose to select a record, but it just doesn't select anything out.  What's wrong with my query?

Dim query As List(Of Class1) = (From c In customers _
 Where c.customerID = "100" AndAlso c.StoreNumber = "B100" AndAlso c.State = "GA" _
                                                         Select c).ToList()

I want the customer whose customerID is 100, and storenumber is B100 and state is Georgia to be selected, but nothing come out.
5281Asked:
Who is Participating?
 
Jens FiedererConnect With a Mentor Test Developer/ValidatorCommented:
Have you tried each of the other 2 criteria (store number and state) separately to see if one of them cancels everything out?
0
 
Jens FiedererTest Developer/ValidatorCommented:
Is customerID a numeric or a string?  If numeric, try  c.customerID = 100
0
 
5281Author Commented:
customerID is a string.  If I just select customerID like below, it would work, if I added other criteria, it doesn't select anything out.

Dim query As List(Of Class1) = (From c In customers _
                                                     Where c.customerID = "100" _
                                                         Select c).ToList()
0
 
Fernando SotoConnect With a Mentor RetiredCommented:
Are you getting an exception at run time?
0
 
5281Author Commented:
Oh, yes.  When I tried seperately, one of criterial storenumber cancel out everything.  I found I did not use Trim() function when I read them into List.  So it may contain space.  Thank you for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.