如何在datatable中传递linq查询

时间:2014-08-18 09:54:04

标签: entity-framework datatable

我想收集所有行并将其传递给datatable。我的linq查询:

var queryAll = from all in db.tblMake select all ;
DataTable dt = new DataTable();

如何将queryAll传递给datatable dt?

如果我尝试:

 IEnumerable<DataRow> queryAll = from all in db.tblMake.AsEnumerable() select all;

出现错误:

 Cannot Implicitely Convert type 'System.Collection.Generic.IEnumerable<Workshop2s.Models.tblMake>' to 'System.Collection.Generic.IEnumerable<System.Data.DataRow>'

0 个答案:

没有答案