if we have 3 records with employeeID,name and dateofbirth coloumns..and we have to show two coloumns out of these three coloumns ..then how can you show in c# code using LINQ code in it ?
LINQ C#VS2010
Page 1 of 12 Replies - 2020 Views - Last Post: 05 October 2010 - 09:20 AM
Replies To: LINQ C#VS2010
#2
Re: LINQ C#VS2010
Posted 04 October 2010 - 09:19 PM
var employees = from c in myDataContext.Employees
select new Employee
{
Name = c.Name,
DateOfBirth = c.DateOfBirth
};
myDataContext is the name of your Data Context class. Employees will need to match the actual name of your table. Use IntelliSense for this.
Personally, I would get all three columns. You will probably need the EmployeeID later on.
#3
Re: LINQ C#VS2010
Posted 05 October 2010 - 09:20 AM
Quote
Personally, I would get all three columns. You will probably need the EmployeeID later on.
Agreed. There's no reason to lose data for display purposes. You just don't have to bind a UI component to that specific field.
Page 1 of 1
|
|

New Topic/Question
Reply
MultiQuote






|