Link to home
Start Free TrialLog in
Avatar of badpilot
badpilot

asked on

Convert T-SQL to Linq

Hello, could someone convert this to Linq2Sql please?

SELECT *
FROM            Customers
WHERE  (FirstName LIKE @FirstName OR @FirstName IS NULL OR @FirstName = '')
  AND  (LastName LIKE @LastName OR @Lastname IS NULL or @LastName = '')
  AND  (PostCode LIKE @PostCode OR @PostCode IS NULL or @PostCode = '')
  AND  (EmailAddress LIKE @EmailAddress OR @EmailAddress IS NULL OR @EmailAddress = '')
  AND  (ContactTel LIKE @ContactTel OR @ContactTel IS NULL OR @ContactTel = '')

Thanks!
Avatar of dj_alik
dj_alik

C# like this:
var result = from customer in  Customers
where customer.FirstName.StartWith(youpatameter...) AND .............  
select customer
SOLUTION
Avatar of jeebukarthikeyan
jeebukarthikeyan
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Alpesh Patel
Alpesh Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial