Here's my SQL query:
SELECT EmployeeID, EmployeeLastName + ', ' + EmployeeFirstName AS Name
FROM employees
ORDER BY Name
How can I go about doing the samething in LINQ to SQL?
Printable View
Here's my SQL query:
SELECT EmployeeID, EmployeeLastName + ', ' + EmployeeFirstName AS Name
FROM employees
ORDER BY Name
How can I go about doing the samething in LINQ to SQL?
Extend your Employee Linq class.
Code:Partial Public Class Employee
Public ReadOnly Property LastFirstName() As String
Get
Return FirstName & " " & LastName
End Get
End Property
End Class
Code:Dim employees = From e In ctx.Employees
Order By e.Name
Select e.EmployeeId, e.Name