问题
I am getting this 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
回答1:
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.
来源:https://stackoverflow.com/questions/5741048/converting-tolist-throws-exception-object-must-implement-iconvertible