Accepted answer

use this line in your query:

where row.field<decimal?>("parentid") == rootid

decimal? is syntactic sugar for system.nullable<decimal>, which is essentially the same as decimal, except that it also allows for null values.

long is a different type altogether -- it can only represent integers and not decimal values, hence the "specified cast is not valid" error.


long rootid is nullable type? it should be then only it can accept nulls

Related Query

More Query from same tag