field<t> invalid cast

Posted by Zwempha on Stack Overflow See other posts from Stack Overflow or by Zwempha
Published on 2010-04-30T06:31:17Z Indexed on 2010/04/30 6:37 UTC
Read the original article Hit count: 253

Filed under:
|
|

I'm having problems when using linq on a datatable.asenumerable().
This throws InvalidCastException.

DateTime date=r.Field<DateTime>("date");

This works fine.

DateTime date = DateTime.Parse(r.Field<string>("date"));

What am I missing?

Regards Sven

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ