Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
Hello !
I am trying to cast a generic DataRow Object to my Typed DataRow Object
C#
dsUIContentType.UIContentTypeRow drTyped = (dsUIContentType.UIContentTypeRow)dr;


. But i get an exeption :

Unable to cast object of type 'System.Data.DataRow' to type 'UIContentTypeRow'.

when casting from a number, the value must be a number less than infinity.

What's the solution?
Posted
Updated 7-May-12 21:06pm
v2
Comments
Herman<T>.Instance 8-May-12 9:23am    
How many values in the Database are NULL? I guess that is the basic of this error. You try to cast NULL to decimal or int. Better make that 'Decimal?' or 'int?'
Herman<T>.Instance 8-May-12 9:24am    
Reason for my vote of 4
good question

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900