我只想使用LINQ从MSSQL DB中选择2列.
SQL应该是
select table.col1,table.col2 from table
Run Code Online (Sandbox Code Playgroud)
我试过了
IList<string> myResults =
(
from data in dbconn.table
where table.col5 == null
select new {
col1=data.Id.ToString(),
col2=data.col2
}
).Take(20).ToList();
Run Code Online (Sandbox Code Playgroud)
但这没用.
它说
cannot convert type list <AnonymousType#1> to Ilist<string>
Run Code Online (Sandbox Code Playgroud)