开发者

converting toList() throws exception Object must implement IConvertible

开发者 https://www.devze.com 2023-02-27 06:48 出处:网络
I am getting this开发者_JAVA技巧 exception \"Object must implement IConvertible.\" while converting rules to tolist(). below is my code

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

精彩评论

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