【问题标题】:crystal report dynamic image not showing水晶报表动态图片不显示
【发布时间】:2010-08-26 12:54:17
【问题描述】:

我试图在水晶报表上显示来自数据集 xsd 的图像,但它没有显示图像。请帮我。

问候 里亚兹

    string sql = "select * from ImageUpload";
    SqlDataAdapter da = new SqlDataAdapter(sql, strConn);
    DataSet ds = new DataSet();
    da.Fill(ds, "Image");       

    for (int index = 0; index < ds.Tables[0].Rows.Count; index++)
    {
        if (ds.Tables[0].Rows[index]["thumb_path"].ToString() != "")
        {
            //if (File.Exists(Server.MapPath("~/129204153594EFF/Image13.jpg") +
            //    ds.Tables[0].Rows[index]["thumb_path"].ToString()))

            if (File.Exists(Server.MapPath("~/129204153594EFF/Image13.jpg")))
            {
                LoadImage(ds.Tables[0].Rows[index], "image_stream",
                    Server.MapPath("~/129204153594EFF/Image13.jpg"));
            }
        }
    }

    // ReportDocument crReportDocument = BLL.BusinessLogicLayer.Globals.GetReportDocument("rport.rpt");

    ReportDocument crReportDocument = BLL.BusinessLogicLayer.Globals.GetReportDocument("rport.rpt");

    crReportDocument.SetDataSource(ds.Tables[0]);
    CrystalReportViewer1.ReportSource = crReportDocument;   
}

private void LoadImage(DataRow objDataRow, string strImageField, string FilePath)
{
    try
    {
        FileStream fs = new FileStream(FilePath, System.IO.FileMode.Open,
        System.IO.FileAccess.Read);
        byte[] Image = new byte[fs.Length];
        fs.Read(Image, 0, Convert.ToInt32(fs.Length));
        fs.Close();
        objDataRow[strImageField] = Image;
    }
    catch (Exception ex)
    {
        //Handler
    }
}

【问题讨论】:

    标签: c# asp.net crystal-reports


    【解决方案1】:

    为水晶报告添加适当的令牌和版本,然后您就可以转到您的 web.config 文件了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-09-25
      • 1970-01-01
      • 2023-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多