Asp.net mvc 5 如何在参数中添加图像字节数组,以便在MVC5的rdlc/crystal报表中显示

Asp.net mvc 5 如何在参数中添加图像字节数组,以便在MVC5的rdlc/crystal报表中显示,asp.net-mvc-5,crystal-reports,rdlc,Asp.net Mvc 5,Crystal Reports,Rdlc,我创建了数据集并在其中添加了列,并从控制器传递信息,但所有信息都显示为接受字节数组。我想在crystal报表中显示数据库字节数组中的图像。以下给出了控制器的操作代码: var finalResult = healthCardViewMod.ToList().Select(listPrint => new { ImageByte = listPrint.ImageByte, ImagePath = listPrint.Im

我创建了数据集并在其中添加了列,并从控制器传递信息,但所有信息都显示为接受字节数组。我想在crystal报表中显示数据库字节数组中的图像。以下给出了控制器的操作代码:

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");

您是否在crystal report中添加了ImageByte字段?因为无论何时数据字段被传递到crystal report,它都会为除字节数组之外的所有内容创建列。只需从字段管理器拖放字段并将其添加到报表中。您是否已在crystal报表中添加ImageByte字段?因为无论何时数据字段被传递到crystal report,它都会为除字节数组之外的所有内容创建列。只需从“字段资源管理器”中拖放字段并将其添加到报告中即可。