dataGrid.DataSource = customDS.customDT.AsEnumerable()
.GroupBy(r => r.Field("someID"))
.Select(g => {
CustomDS.customRow row = customDS.customDT.NewcustomRow();
row["someID"] = g.Key;
row["Tradingdate"] = g.First().Tradingdate;
row["MemberNo"] = ((object)g.First().MemberNo == DBNull.Value) ? "a" : "b";
row["Amt"] = (decimal?)g.Sum(r => r.Field("Amt"));
return row;
}).CopyToDataTable();
我有抛出异常,因为上面的代码MemberNo是DBNull在customDT。在上述情况下,我不理解为已经通过转换为对象并与DBNull进行比较并将其硬编码转换为字符串a或b
蓝山帝景
拉风的咖菲猫
慕尼黑的夜晚无繁华
相关分类