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

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

请高手指点。
...全文
125 6 打赏 收藏 转发到动态 举报
写回复
用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
  • 打赏
  • 举报
回复
Paperback: 1625 pages Publisher: Apress; 7th ed. 2015 edition (January 1, 2016) Language: English ISBN-10: 1484213335 ISBN-13: 978-1484213339 This new 7th edition of Pro C# 6.0 and the .NET 4.6 Platform has been completely revised and rewritten to reflect the latest changes to the C# language specification and new advances in the .NET Framework. You'll find new chapters covering all the important new features that make .NET 4.6 the most comprehensive release yet, including: A Refined ADO.NET Entity Framework Programming Model Numerous IDE and MVVM Enhancements for WPF Desktop Development Numerous updates to the ASP.NET Web APIs This comes on top of award winning coverage of core C# features, both old and new, that have made the previous editions of this book so popular. Readers will gain a solid foundation of object-oriented development techniques, attributes and reflection, generics and collections as well as numerous advanced topics not found in other texts (such as CIL opcodes and emitting dynamic assemblies). The mission of this book is to provide you with a comprehensive foundation in the C# programming language and the core aspects of the .NET platform plus overviews of technologies built on top of C# and .NET (ADO.NET and Entity Framework, Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF), ASP.NET (WebForms, MVC, WebAPI).). Once you digest the information presented in these chapters, you’ll be in a perfect position to apply this knowledge to your specific programming assignments, and you’ll be well equipped to explore the .NET universe on your own terms. What you’ll learn Be the first to understand the .NET 4.6 platform and C# 6. Discover the ins and outs of the leading .NET technology. Learn from an award-winning author who has been teaching the .NET world since version 1.0. Find complete coverage of XAML, .NET 4.6 and Visual Studio 2015 together with discussion of the new Windows Runtime. Who this book is for This book is perfect for anyone who is interested in the new .NET Framework 4.6 and the C# language. Whether you are moving to .NET for the first time or are already writing applications using previous .NET versions, this book will provide you with a comprehensive grounding in the new technology and serve as a complete reference throughout your coding career.

4,819

社区成员

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

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