none
[Tanya] Membuat Barcode pada Crystal Report RRS feed

  • Pertanyaan

  • Teman-teman mohon bantuannya.

    Saya coba membuat Barcode pada Crystal Report menggunakan BarcodeLib.Barcode.CrystalReports.dll

    (kalau ada cara lebih mudah, mohon info dari teman-teman).

    Yang jadi masalah seperti ini, waktu running aplikasi web yang saya buat, untuk menampilkan Report yang ada Barcode pada Crystal Reports, pada Crystal Report tidak muncul barcode yang saya inginkan, tapi muncul tulisan System.Byte[]

    pada file Barcode.aspx saya menggunakan script seperti ini:

    <%@ Page Language="vb" debug="true" %>
    
    <%@ Import Namespace="System.Data" %>
    
    <%@ Import Namespace="CrystalDecisions.CrystalReports.Engine" %>
    
    <%@ Import Namespace="MySql.Data.MySqlClient" %>
    <%@ Import Namespace="System.Drawing.Imaging" %>
    <%@ Import Namespace="BarcodeLib.Barcode.CrystalReports" %>
    <%@ Import Namespace="BarcodeLib.Barcode" %>
    
    <%@ Register assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script language="vbscript" runat="server">
        Dim cnn As New MySqlConnection
        Dim cmd As New MySqlCommand
        Dim DA As New MySqlDataAdapter
        Dim ds As DSBarcode
        Protected Sub Page_Init(sender As Object, e As System.EventArgs)
            Dim connStr As String = ConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString
            cnn = New MySqlConnection(connStr)
            
            cmd.CommandText = "SELECT barcode FROM EXP1 WHERE barcode NOT IN (SELECT barcode FROM `tbbeli_copy`)"
            cmd.CommandType = Data.CommandType.Text
            cmd.Connection = cnn
            If cmd.Connection.State = Data.ConnectionState.Closed Then
                cmd.Connection.Open()
            End If
            DA.SelectCommand = cmd
            ds = New DSBarcode
            
            DA.Fill(ds, "DTBarcode")
            If ds.Tables("DTBarcode").Rows.Count > 0 Then
               
                Dim barcode As New LinearCrystal()
                barcode.Type = BarcodeType.CODE128
                barcode.BarHeight = 50
                barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png
                For Each dr As DataRow In ds.Tables("DTBarcode").Rows
                    barcode.Data = CInt(dr("Barcode"))
                   
                    Dim imageData As Byte() = barcode.drawBarcodeAsBytes()
                    dr("Barcode") = imageData
                    
                
                Next
                
                
                Dim rpt As New ReportDocument
                rpt = New crBarcode
                rpt.SetDataSource(ds)
                CrystalReportViewer1.ReportSource = rpt
                CrystalReportViewer1.RefreshReport()
            Else
                
            End If
            '===================================
           
            
        End Sub
    </script>

    ini hasil yang tampil di Crystal Report.


    Selasa, 15 April 2014 13.00

Jawaban