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
You can select to an anonymous type, for example
var dataset2 =
(from recordset in entities.processlists
where recordset.ProcessName == processname
select new
{
serverName = recordset.ServerName,
processId = recordset.ProcessID,
username = recordset.Username
}).ToList();
Or you can create a new class that will represent your selection, for example
public class MyDataSet
{
public string ServerName { get; set; }
public string ProcessId { get; set; }
public string Username { get; set; }
}
then you can for example do the following
var dataset2 =
(from recordset in entities.processlists
where recordset.ProcessName == processname
select new MyDataSet
{
ServerName = recordset.ServerName,
ProcessId = recordset.ProcessID,
Username = recordset.Username
}).ToList();