首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

求急解决方法

2012-01-12 
求急????wApp.Selection.TypeText(BusinessLogic.PublicEnum.GetEnumDescription(System.Enum.Parse(typeo

求急????
wApp.Selection.TypeText(BusinessLogic.PublicEnum.GetEnumDescription       (System.Enum.Parse(typeof(BusinessEntity.DocumentType),   sdr[ "HolderDocumentType "].ToString().Replace( "HolderDocumentType ",   " "))));

值是-1我把-1替换为空   为什么还是显示-1呢,我试过好多次.枚举替换怎么替换啊,也是一样吗?
wApp.Selection.TypeText(BusinessLogic.PublicEnum.GetEnumDescription       (System.Enum.Parse(typeof(BusinessEntity.DocumentType),   sdr[ "HolderDocumentType "].ToString().Replace( "-1 ",   " "))));
这样做也不行
wApp.Selection.TypeText(BusinessLogic.PublicEnum.GetEnumDescription       (System.Enum.Parse(typeof(BusinessEntity.DocumentType),   sdr[ "DocumentType "].ToString().Replace( "DocumentType ",   " "))));
这样也不行
也不可能是空值啊,都是显示-1

[解决办法]
数据库中一样。默认值是 -1
[解决办法]
sdr 是 SqlDataReader ?

请你输出 sdr[ "HolderDocumentType "].ToString() 是什么?

sdr[ "HolderDocumentType "].ToString() 中包含 "HolderDocumentType " 吗?

比较好的方式是,数据库中存储枚举值,而不是名称,such as

BusinessEntity.DocumentType docType = (BusinessEntity.DocumentType)((int)sdr[ "HolderDocumentType "]); // 这里假设 BusinessEntity.DocumentType 的基元类型是 int

热点排行