Barcode C# > Barcode in C#
Crystal Report Barcode Library SDK - Overview
Barcode Creator DLL for Crystal Reports is a dynamic .NET component that easily adds barcode functionality and compatibility into C# Crystal Reports in both Windows edition and ASP.NET versions. With the database in C#.NET, users are easy to display barcode images in Crystal Reports without other barcode component or barcode fonts involved.
Terrek provides a variety of solutions step-by-step for generating barcodes in Crystal Reports such as using VB.NET class library to generate barcodes in Crystal Reports, create barcodes in WinForms Crystal Report, print barcodes in ASP.NET Crystal Report. Prerequisites and Compatibility Prerequisites
Compatibility
Generate Barcodes in Crystal Report Windows Version using C#.NET Class Library
Sample Code of Generating Barcode Images in Crystal Reports in Windows Forms using C#.NET
private void Form1_Load(object sender, EventArgs e) { OleDbConnection aConnection = new OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Demo/BarcodeDemoData.mdb"); aConnection.Open(); OleDbDataAdapter dataAdapter = new OleDbDataAdapter("select * from Customer", aConnection); DataSet ds = new DataSet(); dataAdapter.Fill(ds); //add a new column named "Barcode" to the DataSet, the new column data type is byte[] ds.Tables[0].Columns.Add(new DataColumn("Barcode", typeof(byte[]))); BarcodeControl qrcode = new BarcodeControl(); qrcode. Symbol = BarcodeSymbol.QRCode; foreach (DataRow dr in ds.Tables[0].Rows) { qrcode.BarcodeData = (int)dr["CustomerId"] + ""; byte[] imageData = barcode.generateBarcodeToByteArray(); dr["Barcode"] = imageData; } CrystalReport1 rpt = new CrystalReport1(); rpt.SetDataSource(ds); this.crystalReportViewer1.ReportSource = rpt; aConnection.Close(); Generate Barcodes in Crystal Report ASP.NET Version using C#.NET Class Library
Sample Code of Creating Barcode Images in ASP.NET Crystal Report using C#
protected void Page_Load(object sender, EventArgs e) { OleDbConnection aConnection = new OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Demo/BarcodeDemoData. mdb"); aConnection.Open(); OleDbDataAdapter dataAdapter = new OleDbDataAdapter ("select * from Customer", aConnection); DataSet ds = new DataSet(); dataAdapter.Fill(ds); //add a new column named "Barcode" to the DataSet, the new column data type is byte[] ds.Tables[0].Columns.Add(new DataColumn("Barcode", typeof(byte[]))); BarcodeControl barcode = new BarcodeControl(); barcode. Symbol = BarcodeSymbol.Code39; foreach (DataRow dr in ds.Tables[0].Rows) { barcode.BarcodeData = (int)dr["CustomerId"] + ""; byte[] imageData = barcode.drawBarcodeAsBytes(); dr["Barcode"] = imageData; } CrystalReportSource1.ReportDocument.Load(Server.MapPath ("CrystalReport1.rpt")); CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]); CrystalReportSource1.DataBind(); aConnection.Close(); } |
Copyright © Terrek.com 2014.All rights reserved.
Code 39 .NET | Code 128 ASP.NET | PDF417 C#.NET | Data Matrix VB.NET | QRCode Java | UPC-A Crystal | Linear Barcodes SSRS | 2D Barcodes RDLC |