See Also
Other Platforms
Features
Buy Now
Online Help
Demo
Licensing

Back
 

How to use Barcode Professional in Reporting Services 2000 - Access Card sample

Technologies used
  • Neodynamic Barcode Professional for Reporting Services (any version)
  • Microsoft SQL Server 2000 Reporting Services
  • Microsoft .NET Framework 1.1 or greater
  • Microsoft Visual Studio .NET 2003 or greater
Due to its flexible design, Barcode Professional allows you to display barcode images in Microsoft SQL Server 2000 Reporting Services reports. You can use all Barcode Symbologies – Linear & 2D – built-in Barcode Professional.
In the following sample we're going to create a Reporting Services report project which displays barcode images into it by using Barcode Professional and Visual Studio .NET 2003.
In this sample we'll create a fictitious access cards report for Northwind's Employees.
Follow these steps:
  • Open Visual Studio .NET 2003 and create a new Report Project.
  • In the Solution Explorer, click on Report > Add > Add New Item... and in the Add New Item dialog box select the Report icon and name it NorthwindAccessCard.rdl. Then click OK
  • Add a new Data Source from the Solution Explorer clicking on Shared Data Sources > Add New Data Source. Look for Northwind Database sample installed in a SQL Server.
  • In the Data tab of the Report designer, add a new DataSet as is shown in the following figure.

    Reporting Services - Dataset

  • In this sample we'll use the Code 128 Barcode Symbology, but remember that you can use ANY Barcode Symbology built-in Barcode Professional.

    Follow these steps:
    • Ensure to install Barcode Professional for Reporting Services. Please read the Installation and Configuration topic in the Barcode Professional for Reporting Services documentation.
    • In Visual Studio .NET 2003 and with the report opened at design-time, add a reference to the Barcode Professional assembly (Neodynamic.ReportingServices.Barcode.dll) going to Report > Report properties... Add the reference as is shown in the following figure:
      Note that the assembly version could be different from the image depending on the Barcode Professional for Reporting Services version installed on your machine.

      Reporting Services - Report Properties

      We'll need to create an instance of Barcode Professional to use it then in a custom function on the Report's Code section. To do this, add a new entry in the Classes grid as is shown in the following figure. Notice that the instance will be named objBarcode and that the full reference to the class is Neodynamic.ReportingServices.Barcode

      Reporting Services - Report Properties

    • Finally, we'll create a VB.NET function which will be invoked to get the appropriate Code 128 barcode image by using the Barcode Professional instance created in the previous step. In the Code tab write the following code:
      IMPORTANT: If you are using Barcode Professional 3.0 or greater, then modify the line objBarcode.BarHeight = 50 in the function below to objBarcode.BarHeight = 0.5 because in those new versions all barcode-related dimensions are measured in inches instead of pixel!
      Public Function GetBarcode(ByVal code As String) As Byte()
        'Set the value to encode
        objBarcode.Code = code
        'Set the Code 128 Barcode Symbology
        objBarcode.Symbology = _
        Neodynamic.ReportingServices.Symbology.Code128
        'Set the Bar's height to 50 px
        objBarcode.BarHeight = 50
        'Hide the value to encode in the barcode image
        objBarcode.DisplayCode = False
        'Generate the barcode image
        Return objBarcode.GetBarcodeImage()
      End Function							
      
      This VB.NET function called GetBarcode requires a code parameter. This value will be specified with a field of the DataSet in the Data Source report. And as you can see in this function you can set any property of Barcode Professional.

      Reporting Services - Code Tab

      Click OK to close the dialog box.
  • Now we need to design the Access Card report layout. In the Layout tab of the report drag & drop the following controls and fields as is shown in the following figure:

    Reporting Services - Access Card report layout

    The image control that will hold the barcode image has to have its Source property set to Database and the Value property to something like the following expression:

    =Code.GetBarcode("EMPLOYEE" + Fields!EmployeeID.Value.ToString)

    Reporting Services - Image Control Properties

    Notice that in this case we've prefixed the EmployeeID field with the string "EMPLOYEE" in order to get a significant barcode image. But it's only a sample and you could specify only the EmployeeID field if you want to.
  • Click on Preview tab and you should get something like the following figure shows:

    Reporting Services - Access Card Preview

  • Deployment Information

    To deploy a Reporting Services report that uses Barcode Professional read the Deployment topic in the Barcode Professional for Reporting Services documentation.
  • That's it. The Report Server is ready to deliver reports featuring barcode images.

    Reporting Services - Access Card Deployment
If you need more information or assistance, please contact our .
 Copyright © 2003 - 2009 Neodynamic S.R.L. All rights reserved.