投放数据行出现问题 [英] Problem in cast data row

查看:160
本文介绍了投放数据行出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!
我正在尝试将通用DataRow对象转换为我的Typed DataRow对象

Hello !
I am trying to cast a generic DataRow Object to my Typed DataRow Object

dsUIContentType.UIContentTypeRow drTyped = (dsUIContentType.UIContentTypeRow)dr;



.但是我得到了一个惊喜:

无法将类型为"System.Data.DataRow"的对象转换为类型为"UIContentTypeRow".

从数字强制转换时,该值必须是小于无穷大的数字.

解决方案是什么?



. 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?

推荐答案

代码看起来不错...但是您的UIContentTypeRow类是否派生自System.Data.DataRow

以下是有用的链接列表:
http://blogs.msdn.com/b/jeff_adkins/archive/2004/03/15/89825.aspx [ ^ ]
http://msdn.microsoft.com/pl-pl/magazine/cc301565% 28en-us%29.aspx [ ^ ]
如何为我的课程提供自定义转换支持? [ ^ ]
将基本类型转换为派生类型 [ http://www.diaryofaninja. com/blog/2010/03/24/the-black-arts-of-custom-type-conversion-in-c [
Code looks fine... but does your UIContentTypeRow class derives from System.Data.DataRow

Here is a list of useful links:
http://blogs.msdn.com/b/jeff_adkins/archive/2004/03/15/89825.aspx[^]
http://msdn.microsoft.com/pl-pl/magazine/cc301565%28en-us%29.aspx[^]
How do I provide custom cast support for my class?[^]
Convert Base Type to Derived Type[^]
http://www.diaryofaninja.com/blog/2010/03/24/the-black-arts-of-custom-type-conversion-in-c[^]


这篇关于投放数据行出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆