C# RDLC 报告查看器 - 显示数据库中的多个图像 - 不起作用

问题描述 投票:0回答:1

我需要构建一个包含多个数据内容的报表查看器,包括来自 MySQL 数据库的图像(mediumBlob)数据字段(不是图像路径)。 我创建了一个包含多个数据表的数据集,然后将它们提供给报告查看器。 当然,图像字段设置为 System.Byte[]。 enter image description here 所有数据都显示正常,但只有图像出现如下错误: enter image description here

我的代码:

    private void finMOM_Load(object sender, EventArgs e)
    {
        DateTime today = DateTime.Today;
        string year = today.Year.ToString();
        string month = today.Month.ToString();
        string day = today.Day.ToString();
        tbxSubject.Text = $"[{ProjectCode}] MOM{year}{month}{day}";

        rpvMOM.LocalReport.DataSources.Clear();
        DataTable mom = MOMDAO.Instance.LoadMOMByID(MomID);
        DataTable attendee = AttendeeDAO.Instance.LoadAttendee(MomID);
        DataTable matter = MatterDAO.Instance.LoadMatter(MomID);
        ReportDataSource momds = new ReportDataSource("MOM", mom);
        ReportDataSource attendeeds = new ReportDataSource("Attendee", attendee);
        ReportDataSource matterds = new ReportDataSource("Matter", matter);
        rpvMOM.LocalReport.ReportPath = "inMOM.rdlc";
        rpvMOM.LocalReport.DataSources.Add(momds);
        rpvMOM.LocalReport.DataSources.Add(attendeeds);
        rpvMOM.LocalReport.DataSources.Add(matterds);
        rpvMOM.RefreshReport();
    }

请帮我解决这个问题。 预先感谢您。

应该是这样的: enter image description here

c# image rdlc
1个回答
0
投票

我已经找到解决办法了,其实很简单:

  1. 从工具箱中添加图像到表格中: Add image inside the data field of the table

  2. 更改图像属性以满足您的需要: Properties image

  3. 结果: Awsome!

© www.soinside.com 2019 - 2024. All rights reserved.