Hi Experts,
I am trying to export the Crystal report using the following source code.
Try
Dim objRecSet As SAPbobsCOM.Recordset
Dim strSQL, strFolder As String
Dim objFSO
Dim CryRpt As ReportDocument
CryRpt = New ReportDocument
objRecSet = objSBOAPI.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
strSQL = "select * from [@ZAM_SRVPSWD]"
objRecSet.DoQuery(strSQL)
If objRecSet.RecordCount > 0 Then
strFolder = objRecSet.Fields.Item("U_Path").Value
objFSO = CreateObject("Scripting.FileSystemObject")
CryRpt.Load("Voucher.rpt")
Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldLocation As ParameterFieldDefinition
Dim crParameterValues As ParameterValues
crParameterFieldDefinitions = CryRpt.DataDefinition.ParameterFields
crParameterFieldLocation = crParameterFieldDefinitions.Item("DocKey@")
crParameterValues = crParameterFieldLocation.CurrentValues
crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = objform.Items.Item("Item_4_U_G").Specific.value
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
Dim crtableLogoninfos As New TableLogOnInfos
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
Dim CrTable As Table
With crConnectionInfo
.ServerName = objSBOAPI.oCompany.Server
.DatabaseName = objSBOAPI.oCompany.CompanyDB
.UserID = objRecSet.Fields.Item("U_username").Value
.Password = objRecSet.Fields.Item("U_password").Value
End With
CrTables = CryRpt.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New _
DiskFileDestinationOptions()
Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions()
Dim strNo As String = objform.Items.Item("Item_4_U_G").Specific.value
Dim strFolderPath As String
strFolderPath = strFolder & "\" '+"\" + objRecSet.Fields.Item("CardName").Value &"\"
If Not objFSO.FolderExists(strFolderPath) Then
objFSO.CreateFolder(strFolderPath)
End If
CrDiskFileDestinationOptions.DiskFileName = _
strFolderPath + strNo & ".pdf"
CrExportOptions = CryRpt.ExportOptions
With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
CryRpt.Export()
Dim strPDFFileName As String
strPDFFileName = strFolderPath + strNo & ".pdf"
releaseObject(CryRpt)
GC.Collect()
End If
Catch ex As Exception
objSBOAPI.SBO_Appln.MessageBox(ex.ToString)
End Try
When I execute the addon on the client of the server the report successfully exported, but when is executed on a client I am getting the Error: "The database DLL 'crdb_b1.dll' could not be loaded" At theCryRpt.Export() command
We have already check the threat The database DLL 'crdb_b1.dll' could not be loaded | SCN
We are using
SAP Business One 9.0 PL: 13 and Crystal Report 2013
Please Advice
Kind regards
Vasilis Korolis