当前位置:网站首页>C # realizes crystal report binding data and printing 3-qr code barcode
C # realizes crystal report binding data and printing 3-qr code barcode
2022-07-05 17:17:00 【coder i++】
C# Realize crystal report binding data and printing 3- QR code bar code
Display barcode in crystal report / QR code
1、 Convert numbers or characters into barcode or QR code
2、 Display the barcode or QR code in the report
Operation of QR code dll
zxing.net
Reference resources :https://blog.csdn.net/xiaoyong_net/article/details/51242190
Insert a picture
Reference resources :https://www.cnblogs.com/babyt/archive/2009/05/26/1490368.html
It is mainly about how to read local pictures and display them in the report .
If it is CR XI And above , You can use a simpler method , Reference resources : Another simple scheme for dynamic loading of crystal report pictures
The method of this paper is : How to dynamically load pictures in crystal reports ( Image file version and database version ) Image file version in .
This article applies to VS2003 And VS2005 Crystal report with its own version , Of course, the same applies to CR XI And above , Just a little annoying .
This article USES the VS2005 And the crystal report with its own version .
ad locum , I'll refine the proposition again :
There is already a complete report , Now the report needs to load a local disk image as logo. Statements in Logo Automatically change with the change of local pictures . Generally, we insert a pictureobject To insert disk pictures , But after inserting , The picture becomes a report , Cannot achieve the purpose of change .
1、 First of all, we have a complete crystal report application for a single table
2、 In order to connect our local pictures , stay dataset Create a new table in mylogo. Put two fields inside , Field type is System.Byte[] or System.SByte[]
Be careful , There are only System.Bytet and System.SByte, To enter by yourself .
This mylogo It's an intermediary , We read the local pictures into this table , Crystal report read the picture from this table .
3、 Add a sub report to the existing report , This is the data source mylogo Drag the two fields onto the sub report .
4、 The code looks like this
// Set data source information
DataSet1 ds1 = new DataSet1();
OleDbDataAdapter da = new OleDbDataAdapter();
String connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath ("~/app_data/test.mdb")+";";
OleDbConnection cn = new OleDbConnection(connstr);
// Get recordset , Be careful , The record set finally obtained needs to be consistent with xsd It's the same structure !
da = new OleDbDataAdapter("SELECT EmployeeId1 as EmployeeId,EmployeeName1 as EmployeeName From Employee1", cn);
da.Fill(ds1, "Employee");
// Write the local image to the data set first
// Read the picture to stream, And converted to byte[]
// picture 1
FileStream fs1 = new FileStream(@"c:\1.bmp", FileMode.Open, FileAccess.Read);
BinaryReader br1 = new BinaryReader(fs1);
byte[] bt1 = br1.ReadBytes((int)fs1.Length);
// picture 2
FileStream fs2 = new FileStream(@"c:\a2.jpg", FileMode.Open, FileAccess.Read);
BinaryReader br2 = new BinaryReader(fs2);
byte[] bt2 = br2.ReadBytes((int)fs2.Length);
fs1.Close();
fs2.Close();
// Write to ds1 in ( only 1 That's ok )
ds1.myLogo.AddmyLogoRow(bt1, bt2);
// The above is the data part , It has nothing to do with the report
//-----------------------------------------------------------
// The following is the report
// Use the report object to load the report
string reportPath = Server.MapPath("~/app_data/crystalreport1.rpt");
myReport.Load(reportPath);
// Bind data set , Be careful , A report uses a data set .
myReport.SetDataSource(ds1);
CrystalReportViewer1.ReportSource = myReport;
边栏推荐
- Q2 encryption market investment and financing report in 2022: gamefi becomes an investment keyword
- 【jmeter】jmeter脚本高级写法:接口自动化脚本内全部为变量,参数(参数可jenkins配置),函数等实现完整业务流测试
- 激动人心!2022开放原子全球开源峰会报名火热开启!
- Embedded UC (UNIX System Advanced Programming) -2
- What are the precautions for MySQL group by
- The third lesson of EasyX learning
- Judge whether a string is a full letter sentence
- Embedded-c language-6
- How does the outer disk futures platform distinguish formal security?
- ECU introduction
猜你喜欢

调查显示传统数据安全工具面对勒索软件攻击的失败率高达 60%

7. Scala class

The first EMQ in China joined Amazon cloud technology's "startup acceleration - global partner network program"

国内首家 EMQ 加入亚马逊云科技「初创加速-全球合作伙伴网络计划」

一个满分的项目文档是如何书写的|得物技术

Rider 设置选中单词侧边高亮,去除警告建议高亮

机器学习编译第2讲:张量程序抽象

The second day of learning C language for Asian people

【机器人坐标系第一讲】

Machine learning compilation lesson 2: tensor program abstraction
随机推荐
C#(Winform) 当前线程不在单线程单元中,因此无法实例化 ActiveX 控件
国内首家 EMQ 加入亚马逊云科技「初创加速-全球合作伙伴网络计划」
项目引入jar从私服Nexus 拉去遇到的一个问题
ECU简介
Embedded -arm (bare board development) -2
CMake教程Step5(添加系统自检)
Iphone14 with pill screen may trigger a rush for Chinese consumers
thinkphp3.2.3
Is it safe and reliable to open futures accounts on koufu.com? How to distinguish whether the platform is safe?
Embedded-c language-6
Function sub file writing
【7.7直播预告】《SaaS云原生应用典型架构》大咖讲师教你轻松构建云原生SaaS化应用,难题一一击破,更有华为周边好礼等你领!
Learn about MySQL transaction isolation level
flask解决CORS ERR 问题
Is it safe for qiniu business school to open a stock account? Is it reliable?
[Jianzhi offer] 63 Maximum profit of stock
机器学习编译第2讲:张量程序抽象
Practical example of propeller easydl: automatic scratch recognition of industrial parts
Machine learning compilation lesson 2: tensor program abstraction
Embedded-c Language-5