我试图使用导出为Excell,PDF,TextFile生成报告。那么我在MVC中这样做。我有一类我命名SPBatch(这是我的存储过程的确切名称在我的SQL),它包含以下内容:DataSet在Export中不支持System.Nullable <>
public string BatchNo { get; set; }
public string ProviderName { get; set; }
public Nullable<System.Int32> NoOfClaims { get; set; }
public Nullable<System.Int32> TotalNoOfClaims { get; set; }
public Nullable<System.Decimal> TotalBilled { get; set; }
public Nullable<System.Decimal> TotalInputtedBill { get; set; }
public Nullable<System.DateTime> DateCreated { get; set; }
public Nullable<System.DateTime> DateSubmitted { get; set; }
public Nullable<System.DateTime> DueDate { get; set; }
public string Status { get; set; }
public string RefNo { get; set; }
public string BatchStatus { get; set; }
public string ClaimType { get; set; }
,你可以看到我的一些列的声明为空。它顺利地从表格中搜索和显示结果。我有几个按钮下面这对出口和每次我尝试在Excel导出时的图像按钮,我总是得到这个问题“集不支持System.Nullable <>”在我的这部分代码:
foreach (MemberInfo mi in miArray)
{
if (mi.MemberType == MemberTypes.Property)
{
PropertyInfo pi = mi as PropertyInfo;
dt.Columns.Add(pi.Name, pi.PropertyType); //where the error pop's up.
}
else if (mi.MemberType == MemberTypes.Field)
{
FieldInfo fi = mi as FieldInfo;
dt.Columns.Add(fi.Name, fi.FieldType);
}
}
该错误在评论中显示。你能帮我做些什么吗?我尝试在代码中添加DBNull,但仍然收到相同的错误。我试图删除我的SPBatch中的Nullable,但我得到一个错误,有些表需要声明为Nullable。
我该怎么办?
我不会使用'DataSet',因为它似乎不支持您的需求建议。 –