Ich benutze vs2012 asp.net MVC und Crystal Reports v.13.Dataset unterstützt nicht System Nullable in Crystal Reports
ich habe diesen Fehler, wenn ich versuche, den Crystal Report
DataSet unterstützen> System.Nullable < nicht zu exportieren.
an dieser Linie
rd.SetDataSource (cn.Customers.Select (c => new
public ActionResult Index()
{
ViewBag.listCustomers = cn.Customers.ToList();
return View();
}
public ActionResult Export()
{
ReportDocument rd = new ReportDocument();
rd.Load(Path.Combine(Server.MapPath("~/Reports/CustomerReport.rpt")));
rd.SetDataSource(cn.Customers.Select(c => new
{
CustomerID = c.CustomerID ,
CustomerName = c.CustomerName ,
CustomerEmail = c.CustomerEmail ,
CustomerZipCode = c.CustomerZipCode ,
CustomerCountry = c.CustomerCountry ,
CustomerCity = c.CustomerCity,
}).ToList());
Response.Buffer = false;
Response.ClearContent();
Response.ClearHeaders();
Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf", "CustomerList.pdf");
}
Dies ist die Ansicht:
<table>
<tr>
<td>CustomerID</td>
<td>CustomerName</td>
<td>CustomerEmail</td>
<td>CustomerZipCode</td>
<td>CustomerCountry</td>
<td>CustomerCity</td>
</tr>
@foreach (var cust in ViewBag.listCustomers)
{
<tr>
<td>@cust.CustomerID</td>
<td>@cust.CustomerName</td>
<td>@cust.CustomerEmail</td>
<td>@cust.CustomerZipCode</td>
<td>@cust.CustomerCountry</td>
<td>@cust.CustomerCity</td>
</tr>
}
<br />
<br />
<a href="@Url.Action("Export","Customer")">Export report</a>
</table>