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!
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!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
var result = from customer in Customers
where customer.FirstName.StartWi
select customer