我创建了数据集并在那里添加了列并从我的控制器传递信息但所有信息都显示接受字节数组。我想在我的水晶报告中显示来自数据库字节数组的图像。在控制器的动作代码下方给出:
var finalResult = healthCardViewMod.ToList().Select(listPrint => new
{
ImageByte = listPrint.ImageByte,
ImagePath = listPrint.ImagePath,
MemberName = listPrint.MemberName == null ? "" :
listPrint.MemberName,
MemberId = listPrint.MemberId == null ? "" : listPrint.MemberId,
MemberDob = listPrint.MemberDob == null ?
DateTime.Now.ToString() : listPrint.MemberDob.ToString(),
CommDate = listPrint.CommDate == null ? DateTime.Now.ToString()
: listPrint.CommDate.ToString(),
OrganizationName = listPrint.OrganizationName
}).ToList();
ReportDocument rd = new ReportDocument();
rd.Load(Path.Combine(Server.MapPath("~/Reports/CrystalReport1.rpt")));
rd.SetDataSource(finalResult);
Response.ClearHeaders();
Stream stream =
rd.ExportToStream(
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
stream.Seek(0, SeekOrigin.Begin);
Response.AddHeader("Content-Disposition", "inline;
filename='EmployeeList_" + DateTime.Now + ".pdf'");
return File(stream, "application/pdf");