请各位帮忙,水晶报表利用数据集显示图像的问题
推模式作水晶报表时,先做好一个数据集,曲于一些原因,数据集的结构是一个自定义的结构,和数据库中的表没有关系,在打印报表时,定义一个与数据集里的DataTable一样的普通 DataTable对象,并填充相应的数据,现在的问题是图象字段的内容填充进去后,显示不出来,类似代码如下,请各位帮帮忙
private void PrintData()
{
CustomSchema data = new CustomSchema;
DataTable table = new DataTable();
DataColumnsCollection columns = table.Columns;
//缩简版的自定义结构
columns.Add("F_Name",typeof(System.String)).AllowDBNull=false;
columns.Add("F_Address", typeof(System.String)).AllowDBNull=false;
columns.Add("F_Picture",typeof(System.Byte[])).AllowDBNull=true;
DataRow row = new table.NewRow();
row["F_Name"] = "某某某";
row["F_Address"] = "XX市XX路";
//以下把图象填入字段
MemoryStream ms = new MemoryStream();
pic.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
Byte[] imageBody = ms.ToArray();
row["F_Picture"] = imageBody;
table.Rows.Add(row);
table.TableName="Custom";
data.Tables.Add(table);
//CustomReport 是一个报表
CustomReport cr = new CuustomReport();
CustomReprot.SetDataSource(data.Tables["Custom"]);
//FormPrint 是一个预览报表的窗体,通过 ShowReport 传递要显示的报表
FormPrint frmPrint = new FormPrint();
frmPrint.ShowReport(cr);
}
这样的一段代码,报表最后预览时显示的图像是空的,什么也没有,
请问要正确的显示图像要怎么做?
帮顶者酌情给分,谢谢!