Code 39 Barcode: Code 39 is a discrete and variable-length barcode type, also mentioned as the "Code 3/9", "Code 3 of 9", "USS Code 39", "USD-3", "Alpha39", "Type 39". Besides, Code 39 is the standard barcode used by United States Department of Defense and Health Industry Bar Code Council (HIBCC).
Crystal Reports Linear Barcodes: Code 39, Code 128, EAN-8, EAN-13, GS1-128, ITF-14, Interleaved 2 of 5, UPC-A, UPC-E, Planet, Postnet, OneCode, Code 93, Codabar, Code 11, Code 2 of 5, etc.
Crystal Reports 2D Barcodes: Data Matrix, PDF 417, QR Code.
Code 39 Crystal Reports Barcode Creation for ASP.NET Web Services, Website
Create a new ASP.NET website.
Choose "ASP.NET Crystal Reports Web Site" as the template and named the project as "BarcodeforCrystalReportsWebSite".
Add a new item "Crystal Report" to your project.
Add a new item "Crystal Report" to the project and name it as "CustomerReport.rpt". view image
Select "Mail Label" in the pop-up window and click "OK". view image
In "Mailing Labels Report Creation Wizard", click "Create New Connection", and expand "ADO.NET". view image
In "ADO.NET" form, choose "CustomerDataSet.xsd" file in your downloaded package, and click "Finish". view image
In "Mailing Labels Report Creation Wizard", add table "Customer" under "ADO.NET" to selected table. And click "Next". view image
Add all three fields "ID", "CustomerId", "CustomerName" to "Fields to Display:", then click "Next". view image
Select default label "Return Address (Avery 5267)", and click "Finish".
Now you can view the report template and find that field "Barcode" not in the report template. view image
Now, please re-arrange the report template. view image
Drag field "Barcode" to the report template, right click "Barcode" object and choose "Format Object" menu. view image
In "Format Editor" form, check "Can Grow" property. view image
Drag a "Crystal Report Viewer" to the "Default.aspx".
Add a reference to BarcodeLib.Barcode.CrystalReports.dll.
Copy the following C# code to the "Default.aspx.cs" file.
using System.Data.OleDb; using System.Drawing.Imaging; using BarcodeLib.Barcode.CrystalReports; using BarcodeLib.Barcode;
protectedvoid Page_Load(object sender, EventArgs e) { // Create the database connection. Please change to correct data file (BarcodeDemoData.mdb) path. OleDbConnection aConnection = new OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:/BarcodeLib_NETBarcode_Trial/ReportingData/BarcodeDemoData.mdb"); aConnection.Open();
OleDbDataAdapter dataAdapter = new OleDbDataAdapter("SELECT * FROM Customer", aConnection); DataSet ds = new DataSet(); dataAdapter.Fill(ds);
// Add the Barcode column to the DataSet ds.Tables[0].Columns.Add(new DataColumn("Barcode", typeof(byte[])));
// Create an instance of Linear Barcode LinearCrystal barcode = new LinearCrystal(); // Barcode settings barcode.Type = BarcodeType.CODE39; barcode.BarHeight = 50; //50 pixel barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
CustomerReport rpt = new CustomerReport(); rpt.SetDataSource(ds);
this.crystalReportViewer1.ReportSource = rpt;
//close the connection Its important. aConnection.Close();
}
4. Run your project.
Crystal Reports Linear & 2D Barcode Creation Using C# or VB Code
We provide online developer guide for C# and VB.NET Crystal Reports barcode generating & inserting, as well as Crystal Reporing bar coding for ASP.NET and Windows Forms applications.