Barcode4NET and SQL Server Reporting Services 2000  
                                This tutorial presents how to display barcodes, created with Barcode4NET, in SQL Server Reporting Services 2000 reports. | 
                               
                              
                              
                                 | 
                               
                              
                             
                            Requirements 
                                  Before starting to work on this tutorial,   make sure the following items are available:
                             
                            
                              - Barcode4NET toolkit, any of ASP.NET & Reporting   Services or .Net editions.   
                              
 - Visual Studio .Net 2003   
                              
 - MS SQL 2000 + AdventureWorks database (other data sources can work as well).     
                              
 - SQL Server Reporting Services 2000.
 
                               
                            Building the Employees report 
                             
                            
                                
                                  
                                    | Please follow the steps in the sequence they are presented in order for this   tutorial to work. | 
                                   
                                
                               
                             
                            1. Start Visual Studio .Net 2003 and create a new report project. 
                                                                   
                                   
                          2. In Solution Explorer right click on Reports folder and add a new report using   the Report Wizard. 
                                 
                                      
                                        
                                          
                                            | This tutorial uses the Northwind database that comes with MS SQL 2000. The   report data source uses the Customers table that already exist in the database. | 
                                           
                                        
                                       
                                       
                                      Type the following code for the query string and then click   Next: 
                                       
                                      
                                        
                                          
                                            | SELECT CustomerID, CompanyName, Address, City, PostalCode,   Country FROM Customers | 
                                           
                                        
                                       
                               
                                
                                       
                      3. Select all the fields to be displayed in the details section of the report and   then click Next. 
                                   
                                    
                                       
                      4. In the last step of the Report Wizard set the report   name to CustomersReport and click Finish to create the   report. 
                                     
                                      
             
                                      5. Make sure the report is opened in design mode. Using the Report menu, display the report properties (Report > Report properties...) and   select the References tab. In the References list, click on the   first empty line and type this: 
                                      Barcode4NET, Version=1.0.0.0,   Culture=neutral, PublicKeyToken=fdeffed0f6085085 
                                       
                                      
                                        
                                          
                                            | IMPORTANT: Make sure that Barcod4NET.dll   assembly (located in Bin\Net 1.1) is registered in Global Assembly Cache. If it   is not registered, use the gacutil.exe utility to register the assembly in   GAC. | 
                                           
                                        
                                       
                                                                 
                                        
                                   
                  6. Select the Code tab and type the following function: 
                   
                  
                    
                      
                        Public Function GetBarcodeImage(ByVal data As String) As Byte() 
                              'Create   the barcode 
                              Dim c39 As New O2S.Barcode4NET.Code39Barcode(data) 
                                'Set the barcode size 
                              c39.DimensionUnit =   O2S.Barcode4NET.XYDimensionUnit.Pixel 
                              c39.XDimension = 1 
                                c39.YDimension = 30 
                              'Get the barcode image as a gif image 
                              Return   c39.GetImageData(O2S.Barcode4NET.BarcodeImageFormat.Gif, 0) 
                          End Function | 
                       
                    
                   
                   
                  
                    
                      
                        | This tutorial uses a Code 39 (Code 3 of 9) barcode, but ANY barcode symbology that is supported by Barcode4NET toolkit can be used. | 
                       
                    
                   
                   
                                  
                                 
                                Click OK to save the changes made to report properties.  
                                         
                        7. Select the Image object in the toolbox and drag it in the Customer ID   column. 
                                       
                                        
                                           
                                          8. Select the Image object in Customer ID column and set its   properties: 
                                          MIMEType = image/gif  
                              (the image format here must match the first   parameter of GetImageData method in the code at Step 5) 
                                          Source =   Database 
                                          Value = =Code.GetBarcodeImage(Fields!NationalIDNumber.Value) (the =   sign must appear in front of Code keyword). 
                                          Sizing = AutoSize 
                                                               
                               
              9. Display the report in preview mode (click on Preview tab) to   check that everything is ok. 
                                         
                                          
                                                 
                                            10. Configure the SQL Reporting Services 2000 security policy to allow Barcode4NET   to run in the report context.  
                              Add the following lines to rssrvpolicy.config file   (usually located in C:\Program Files\Microsoft SQL Server\MSSQL\Reporting   Services\ReportServer): 
                                             
                                            
                                              
                                                
                                                  <CodeGroup class="UnionCodeGroup" version="2" PermissionSetName="FullTrust"   Name="Barcode4NETLibrary" Description="This code group grants FullTrust   to Barcode4NET assembly."> 
                                                     <IMembershipCondition   class="StrongNameMembershipCondition" version="2"    
                                                    PublicKeyBlob="00240000048000009400000006020000002400005253413100040000 
                                                    010001003fae1daf0d6dcc969069ced0ebc2d71fabda6a00
                                                    d750fe1e0447e52e3b899a6 
                                                    4355e28d01598d62cf569d888472ab48e4929360b19c774ec0002af83d3352b1ad9c4d3 
                                                    6da271e83c0c0d9dcbb22e0bc39a292
                                                    9446518e66d65d19105203628f47e293ded8091 
                                                    98d35068344a8919905aa5f1b82816a7b8b879ee895869aaa2ac"   /> 
                                                  </CodeGroup> | 
                                                 
                                              
                                             
                                             
                                            
                                              
                                                
                                                  | IMPORTANT: Backup the rssrvpolicy.config file   before making any changes. | 
                                                 
                                              
                                             
                                                                                       
                                              
                                             
                                            
                                              
                                                
                                                  | The installation kit contains sample SQL Reporting Services 2000 configuration   files that show where the <CodeGroup> has to be added. The sample   configuration files are located in   <Barcode4NETInstallPath>\Samples\Reporting Services\Configuration\2000\. | 
                                                 
                                              
                                             
                                           
                          11. Compile the report and deploy it to your SQL Reporting Services 2000 server. 
                                             
                                              
                                                 
                                12. The report can be exported as PDF (or other supported formats) and the barcodes   are preserved. 
                                CustomersReport exported as a PDF document. 
                                               
                                                
                                               
                                               | 
                         
                       
                        
                          
                            
                                
  | 
                           
                          
                            |  NOTE: These tutorials provided here are for educational purposes only, to help 
                              developers understand and use Barcode4NET toolkit more effectively. However, 
                              they are provided AS-IS with not support or warranties expressed or implied. If 
                              you discover a problem, send an email to techsupport@o2sol.com and we'll try to fix it.  | 
                           
                         
                        
  |