C# 图像不显示在crystal报告中

C# 图像不显示在crystal报告中,c#,asp.net,crystal-reports,C#,Asp.net,Crystal Reports,我正在尝试在crystal report中显示图像。在下面的代码中,我转换文件流中的图像路径,然后通过数据表添加到报告源中。但不显示静止图像 string path; DataTable dt = new DataTable(); path = Server.MapPath("~/img/logo.jpg"); DataColumn column = new DataColumn("Image"); //Create the column. column.DataType = Syste

我正在尝试在crystal report中显示图像。在下面的代码中,我转换文件流中的图像路径,然后通过数据表添加到报告源中。但不显示静止图像

string path;
DataTable dt = new DataTable();

path = Server.MapPath("~/img/logo.jpg");   
DataColumn column = new DataColumn("Image"); //Create the column.
column.DataType = System.Type.GetType("System.Byte[]"); 
dt.Columns.Add(column);
DataRow row = dt.NewRow();
FileStream fs = new FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read);
Byte[] Image = new Byte[fs.Length];
fs.Read(Image, 0, Convert.ToInt32(fs.Length));
fs.Close();
row["Image"] = Image;
dt.Rows.Add(row);
dss.Tables[0].Merge(dt);
//set dataset to the report viewer.
rptDoc.SetDataSource(dss);
CrystalReportViewer1.ReportSource = rptDoc;

您只需将图像以字节流的形式保存到数据库中,无需将其转换回crystal reports中使用,只需将图像拖放到报告字段中,用图像调用字段名,图像就会显示出来。。我以前是用C#做的。希望它对你也有用