goldp...@gmail.com
unread,Nov 9, 2006, 12:50:48 AM11/9/06Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to NBear Google Group
Entity.EntityArrayToDataTable方法需要传入一个实体数组,并根据实体数组的内容生成Table
可是如果当实体数组长度为0时,比如数据库刚刚建立,没有数据时,则方法会抛出异常,分析了源码,发现在实现中使用了objs[0]这样的语句,导致出错,
建议判断一下,如果长度为0,就换一种实现方法如:
通地反射取得数组内的元素类型,然后根据此类型构造DataTable
objs.GetType().GetElementType()