Maybe an easy question, but can\'t find it easily so forgive me =) I try to select multiple columns. The statement I use is:
var dataset2 = from recordset in ent
It's correct way to get data in specified type:
var dataset = entities.processlists
.Where(x => x.environmentID == environmentid && x.ProcessName == processname && x.RemoteIP == remoteip && x.CommandLine == commandlinepart)
.Select(x => new { x.ServerName, x.ProcessID, x.Username })
.ToList() /// To get data from database
.Select(x => new PInfo()
{
ServerName = x.ServerName,
ProcessID = x.ProcessID,
Username = x.Username
});
For more information see: The entity cannot be constructed in a LINQ to Entities query