Add a new Data Source for the report. If you have the AventureWorks Database installed in a SQL Server 2005 select it and enter the following SQL Statement:
SELECT ProductID, Name, ProductModel, CultureID FROM Production.vProductAndDescription WHERE (CultureID = N'en')
as is shown in the below figure.
Now we'll design the Product List layout. Open the report at design time and drag & drop the following controls and fields as is shown in the following figure (The control below Product Barcode header is an Image control):
The Image control that will hold the barcode image has to have its Source property set to Database, the Sizing property to AutoSize, the MIMEType property to a image/[format] that matches with the GetBarcodeImage[format] method used in the custom function, and the Value property to
an expression such as the following:
=Code.GetBarcode(Fields!ProductID.Value.ToString)
Now, it's time to display the report onto a WebForm
by using a ReportViewer control. So, open your WebForm at design time and drag & drop a ReportViewer control onto it
and specify the ProductList.rdlc report.
The last thing to do is to add a line of code in the Page_Load event procedure. So, go to it and add the following line:
• For Barcode Professional 2.0:
Visual Basic .NET
Me.ReportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("Neodynamic.ReportingServices.Barcode,
Version=2.0.2000.0, Culture=neutral, PublicKeyToken=c6b33c3093a0d4cd")
Visual C# .NET
this.reportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("Neodynamic.ReportingServices.Barcode,
Version=2.0.2000.0, Culture=neutral, PublicKeyToken=c6b33c3093a0d4cd");
• For Barcode Professional 3.0:
Visual Basic .NET
Me.ReportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("Neodynamic.ReportingServices.Barcode,
Version=3.0.2000.0, Culture=neutral, PublicKeyToken=c6b33c3093a0d4cd")
Visual C# .NET
this.reportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("Neodynamic.ReportingServices.Barcode,
Version=3.0.2000.0, Culture=neutral, PublicKeyToken=c6b33c3093a0d4cd");
• For Barcode Professional 4.0:
Visual Basic .NET
Me.ReportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("Neodynamic.ReportingServices.Barcode,
Version=4.0.2000.0, Culture=neutral, PublicKeyToken=c6b33c3093a0d4cd")
Visual C# .NET
this.reportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("Neodynamic.ReportingServices.Barcode,
Version=4.0.2000.0, Culture=neutral, PublicKeyToken=c6b33c3093a0d4cd");
Ensure that you've registered or installed the Barcode
Professional for SSRS 2005 assembly into the Global Assembly Cache (GAC)