(C#)ASP.net CristalRepot得用法以及怎么在报表上显示图片.

zhang_yugang 2011-04-19 05:02:53
如题,请给些再vs2005中 如何给报表邦定数据,以及如何动态显示图片的方法。

请高手指点。
...全文
108 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
阿双2009 2011-04-26
  • 打赏
  • 举报
回复
水晶报表 貌似不支持gif格式,你换用jpg或bmp试试。。

若仍旧不行,参考:http://www.cnblogs.com/babyt/archive/2008/11/19/1336719.html
zhang_yugang 2011-04-26
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 luols 的回复:]
数据结构要一致,你imagetest字段类型不一致

数据集xsd中的类型 - > base64Binary
而代码中的类型 - > System.Byte[]

把xsd中的类型改为System.Byte[]试试。。
[/Quote]

改成 一样的也不行啊。 你在你机器上 能试吗?
阿双2009 2011-04-25
  • 打赏
  • 举报
回复
数据结构要一致,你imagetest字段类型不一致

数据集xsd中的类型 - > base64Binary
而代码中的类型 - > System.Byte[]

把xsd中的类型改为System.Byte[]试试。。
zhang_yugang 2011-04-25
  • 打赏
  • 举报
回复
自己顶下帖子。
求高手指点啊。。。没人知道了吗啊〉?
zhang_yugang 2011-04-21
  • 打赏
  • 举报
回复
以下是我的源码:在报表上文字的可以显示,但是图片的不显示。

我的是vs2005为什么阿,图片显示一个 红X


xsd源码:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="testDb" targetNamespace="http://tempuri.org/datatest.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/datatest.xsd" xmlns:mstns="http://tempuri.org/datatest.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="text">
<xs:complexType>
<xs:sequence>
<xs:element name="imagetest" type="xs:base64Binary" minOccurs="0" />
<xs:element name="test" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


报表后台代码:
protected void Page_Load(object sender, EventArgs e)
{


FileStream fs1 = new FileStream(@"C:\zyg.gif", FileMode.Open, FileAccess.Read);
BinaryReader br1 = new BinaryReader(fs1);
br1.ReadBytes((int)fs1.Length);

DataSet ds = new DataSet();

ds.Tables.Add("testDb");
ds.Tables[0].Columns.Add("imagetest", System.Type.GetType("System.Byte[]"));
ds.Tables[0].Columns.Add("test", System.Type.GetType("System.String"));

ds.Tables[0].Rows.Add();
ds.Tables[0].Rows[0]["imagetest"] = br1.ReadBytes((int)fs1.Length);
ds.Tables[0].Rows[0]["test"] = "zygsdasdasdaasdasd";

string reportPath = Server.MapPath("CrystalReport1.rpt");
CrystalReportSource1.ReportDocument.Load(reportPath);
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
CrystalReportSource1.DataBind();
CrystalReportViewer1.ReportSource = CrystalReportSource1;
fs1.Close();
}


不知道原因是什么啊。清高手指点下阿。

在线等。。
子夜__ 2011-04-19
  • 打赏
  • 举报
回复
这是第六版的介绍《ASP.NET 4入门经典:涵盖C#和VB.NET(第6版)》内容简介:ASP.NET是.NET Framework的一部分,用于构建内容丰富的动态Web站点。其最新的版本ASP.NET 4对上一版进行了许多改进,包括增强了Web窗体,并添加了jQuery的支持。《ASP.NET 4入门经典:涵盖C#和VB.NET(第6版)》循序渐进,逐步讲解了如何使用ASP.NET 4构建内容丰富的Web站点,并提供了大量使用C#和VB的示例。通过实际动手练习,您将学到关于构建Web站点的第一手信息,同时能够深刻理解在浏览器中查看ASP.NET 4页面时,后台到底发生了什么。 这是第七版,也就是本源码书的介绍 The ultimate programming guide to ASP.NET 4.5, by popular author and Microsoft MVP Imar Spaanjaars Updated for ASP.NET 4.5, this introductory book is filled with helpful examples and contains a user-friendly, step-by-step format. Written by popular author and Microsoft ASP.NET MVP Imar Spaanjaars, this book walks you through ASP.NET, Microsoft's technology for building dynamically generated web pages. This edition retains the highly accessible approach to building the Planet Wrox website example, an online community site featuring product reviews, picture sharing, bonus content for registered users, and more. Contains the comprehensive guide to the latest technology additions to ASP.NET 4.5 Shows how to build basic ASP.NET web pages and configure their server Includes information on how to add features with pre-built server controls Reveals how to design pages and make them consistent Contains the information needed for getting user input and displaying data Beginning ASP.NET 4.5 in C# and VB uses Spaanjaars's distinct writing style to put you at ease with learning ASP.NET 4.5.

4,819

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 图表区
社区管理员
  • 图表区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧