Linq a SQL seleccionar múltiples columnas
Solo quiero seleccionar 2 columnas de una base de datos MSSQL usando LINQ.
El SQL debe ser
select table.col1,table.col2 from table
Lo intenté
IList<string> myResults =
(
from data in dbconn.table
where table.col5 == null
select new {
col1=data.Id.ToString(),
col2=data.col2
}
).Take(20).ToList();
pero esto no funcionó.
Dice
cannot convert type list <AnonymousType#1> to Ilist<string>