我想在 VB.net 中使用水晶报表来显示包含条形码的图像。但是当我运行应用程序时,我在加载报表之前得到以下异常,尽管我已将 crdb_adoplus.dll 的引用添加到我的项目中。
异常:无法加载文件或程序集 'crdb_adoplus, Version=9.1.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' 或其依赖项之一。强名称验证失败。(来自 HRESULT 的异常:0x8013141A)
这是我的代码:
Private Sub Frm_Reporting_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CrystalReportViewer1.ReportSource = Nothing
Dim rptbarcode As RptPacking
rptbarcode = New RptPacking
Dim xrep As DataSet1
xrep = New DataSet1
Dim row As DataRow
Dim MyImg As Image = Nothing
Try
btnEncode(MyImg, BarcodeText)
row = xrep.Tables("DataTable1").NewRow
Dim ms As New MemoryStream()
MyImg.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
Dim ii As Byte()
ii = ms.ToArray()
xrep.Tables("DataTable1").Rows.Add(ii)
rptbarcode.Load("GSMProduction.RptPacking.rpt")
rptbarcode.SetDataSource(xrep.Tables("DataTable1"))
CrystalReportViewer1.ReportSource = rptbarcode
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub btnEncode(ByRef pic As Image, ByVal txtData As String)
Dim W As Integer = 160
Dim H As Integer = 110
Dim b As BarcodeLib.Barcode
Dim type As BarcodeLib.TYPE = BarcodeLib.TYPE.UNSPECIFIED
type = BarcodeLib.TYPE.CODE128
b = New BarcodeLib.Barcode()
Try
If type <> BarcodeLib.TYPE.UNSPECIFIED Then
b.IncludeLabel = True
'===== Encoding performed here =====
pic = b.Encode(type, txtData, W, H)
'CType(Frm, frm_submitentery).pic_img.Image = pic.Image
'===================================
End If
Catch ex As Exception
'try
MessageBox.Show(ex.Message)
'catch
End Try
End Sub
我非常感谢您提前提出的建议。