[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 258
  • Last Modified:

How do you write a LINQ statement with multiple or's

I am trying to search a table but want to use an OR logic instead of the and logic in my statment.  Can someone show me the correct syntax to turn this into OR logic?
var ProviderResult = from providerdata in dcRadRelay.PROVIDERs
                             where providerdata.FIRST_NAME == tbDocFname.Text &&
                             providerdata.LAST_NAME = tbDocLname.Text && 
                             providerdata.CITY = tbDocCity &&
                             providerdata.STATE = tbDocState &&
                             providerdata.ZIP = tbDocZip 
 
 
                             select new { userdata };

Open in new window

0
kwh3856
Asked:
kwh3856
  • 3
1 Solution
 
Sreedhar VengalaCommented:

var ProviderResult = from providerdata in dcRadRelay.PROVIDERs
                             where providerdata.FIRST_NAME == tbDocFname.Text ||                       providerdata.LAST_NAME = tbDocLname.Text ||
                             providerdata.CITY = tbDocCity ||
                             providerdata.STATE = tbDocState ||
                             providerdata.ZIP = tbDocZip 

Open in new window

0
 
Sreedhar VengalaCommented:
use ==
from providerdata in dcRadRelay.PROVIDERs
                             where providerdata.FIRST_NAME == tbDocFname.Text ||
                             providerdata.LAST_NAME == tbDocLname.Text ||
                             providerdata.CITY == tbDocCity ||
                             providerdata.STATE == tbDocState ||
                             providerdata.ZIP = tbDocZip 

Open in new window

0
 
Sreedhar VengalaCommented:

from providerdata in dcRadRelay.PROVIDERs where providerdata.FIRST_NAME == tbDocFname.Text || providerdata.LAST_NAME == tbDocLname.Text || providerdata.CITY == tbDocCity || providerdata.STATE == tbDocState || providerdata.ZIP == tbDocZip 

Open in new window

0
 
kwh3856Author Commented:
Thank you very much.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now