开发者

converting toList() throws exception Object must implement IConvertible

I am getting this开发者_JAVA技巧 exception "Object must implement IConvertible." while converting rules to tolist(). below is my code

var rules = from m in db.Rules select m;
 return rules.ToList().ToDataTable(); // exception occurs here

I am using MySQL 6.3.6 ..the same code is working fine with MSSQL.

I will be grateful if someone helps me in this

regards Umair


Make sure the source type is convertible to the destination type.
Probably the rules.ToList() don't match with you ToDataTable destination cast.

Can you verify what var list = rules.ToList() contains?

And... I suggest deal with List and IEnumerable against Datatable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜