Barcode for Crystal Report > Generate Barcode in ASP.NET
s

Using Barcode Generator for Crystal Reports
How to generate, print barcode labels in Crystal Reports using c#, vb.net, asp.net without font, native ufl. Free download.


How to generate, display, print linear, 2d barcode labels in Crystal Reports asp.net mvc project using c#, vb.net without native font. Free download.



KA.Barcode for Crystal Reports Introduction
KeepAutomation Barcode Generator for Crystal Reports is a professional barcode generating dll that completely runs in .NET Framework environment. It provides perfect barcode solutions for Crystal Reports with the managed C# code.
Compatibility & Requirements
  • Development Environments: Microsoft Visual Studio (several versions), .NET language environment such as Visual C# and Visual Basic.NET, Crystal Reports for .NET (runtime), .NET Framework environment
  • OS Conformance: Windows XP/Windows Vista/Windows 7/Window Server 2005/2008 etc.
Test Environment
  • Microsoft Windows XP
  • Microsoft Visual Studio 2005
  • Visual Basic & C#.NET
How to Generate Barcodes in Crystal Reports in ASP.NET
Simple Introduction of Trial Package
A table named "Product" can be found in the demo dataset "KACrystalData.mdb" in the unzipped trial package. It has three columns ("ID", "ProductId", "ProductName").

"KACrystalData.mdb" contains a ProductDataSet.xsd file to define three columns in the "Product" table. An extra column (named as "Barcode") is also included.
Generate Barcodes in Crystal Reports in Web Forms
  1. Create a web project in your Visual Studio and select ASP.NET Crystal Reports Web Site as template.
  2. In the pop-up window, select choose "Standard" and click "OK".
  3. In "Data" form, double click "Create New Connection" and expand "ADO.NET".
  4. In "ADO.NET" form, connect to "ProductDataSet.xsd" file in your downloaded package, then click "Finish" button. You will see "Table" item under "NewDataSet".
  5. Drag and drop the "Table" item to "Selected Tables" on the right side and click "Next".
  6. In "Fields" form, add all three columns under "Table" item to "Fields to Display" and click "Finish".
  7. In CrystalReport1.rpt, add field "Barcode" to the report Section 3.
  8. Add "KeepAutomation.Barcode.Crystal.dll" to your project reference in "Solution Explorer".
  9. Right click "Default.aspx" in"Solution Explorer" and choose "View Code";
  10. Copy the following sample code and run the project.
C# Sample code
     OleDbConnection aConnection = new OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:/KACrystalData.mdb");
aConnection.Open();

OleDbDataAdapter dataAdapter = new OleDbDataAdapter("select * from Product",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
//Use DataMatrixCrystal for Data Matrix
//Use PDF417Crystal for PDF417
//Use QRCodeCrystal for QR Code
BarCode barcode = new BarCode();
//Barcode settings
barcode.Symbology=KeepAutomation.Barcode.Symbology.QRCode;
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

foreach (DataRow dr in ds.Tables[0].Rows)
{
barcode.CodeToEncode = (int)dr["ProductId"] + "";
byte[] imageData = barcode.generateBarcodeToByteArray();
dr["Barcode"] = imageData;
}
CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport1.rpt"));
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
CrystalReportSource1.DataBind();
VB Sample code
     Dim aConnection As New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/KACrystalData.mdb")
aConnection.Open()

Dim dataAdapter As New OleDbDataAdapter("select * from Product", aConnection)
Dim ds As New DataSet()
dataAdapter.Fill(ds)

'Add the Barcode column to the DataSet
ds.Tables(0).Columns.Add(New DataColumn("Barcode", GetType(Byte())))

'Create an instance of Linear Barcode
'Use DataMatrixCrystal for Data Matrix
'Use PDF417Crystal for PDF417
'Use QRCodeCrystal for QR Code
Dim barcode As New BarCode()
'Barcode settings
barcode.Symbology = KeepAutomation.Barcode.Symbology.QRCode
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png

For Each dr As DataRow In ds.Tables(0).Rows
barcode.CodeToEncode = CInt(dr("ProductId")) & ""
Dim imageData As Byte() = barcode.generateBarcodeToByteArray()
dr("Barcode") = imageData
Next
CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport1.rpt"))
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables(0))
CrystalReportSource1.DataBind()
CompatibilityTest EnvironmentWeb Crystal ReportsUsing C#Using VB.NETUsing ASP.NETUsing .NET WinformsData Matrix for Crystal ReportPDF417 for Crystal ReportQR Code for Crystal ReportmoreCodabar for Crystal ReportCode 39 for Crystal ReportCode 128 for Crystal ReportEAN-8 for Crystal ReportEAN-13 for Crystal ReportEAN 128 for Crystal ReportIntelligent Mail for Crystal ReportInterleaved 2 of 5 for Crystal ReportISBN for Crystal ReportITF-14 for Crystal ReportRM4SCC for Crystal ReportUPC-A for Crystal ReportUPC-E for Crystal Reportmore
KeepAutomation provides complete barcode automation solutions. We recommend the customers use high quality document controls: ASP.NET Document Viewer, ASP.NET MVC Document Viewer, Document Viewer ASP.NET C#, ASP.NET PDF Viewer, ASP.NET Word Viewer, ASP.NET Excel Viewer, ASP.NET PDF Editor, MVC PDF Viewer, ASP.NET Annotate PDF, c# pdf sdk, C# View, edit PDF online , C# Convert PDF to Tiff, C# Convert PDF to text, txt, .net imaging sdk, C# PDF metadata edit from RasterEdge.com.