Click here to Skip to main content
15,880,543 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When try to show Crystal Report error comes:
HTML
Could not load file or assembly 'file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.

Code for Show CrystelReport:
Dim rptInvoiceDt As New DataTable
        PrintReporObj = New DataAccessLayer
        rptInvoiceDt = PrintReporObj.Filldatatable("SELECT * FROM InvoiceReport WHERE JobListID=" & JobAndTrackingMDI.GetJobID & "")
        If rptInvoiceDt.Rows.Count = 0 Then
            KryptonMessageBox.Show("Record Not found")
        Else
            Dim Rpt As New ReportDocument
            Dim ReportPath As String = Application.StartupPath & "\Reports\rptInvoice.rpt"
            Rpt.Load(ReportPath)
            Rpt.SetDataSource(rptInvoiceDt) '<--When This Line execute the error occur -->
            CRVInvoice.ReportSource = Rpt
        End If
Posted
Updated 12-Aug-17 6:55am
v5

 
Share this answer
 
Comments
raviprajapat 25-May-11 9:03am    
thanks
Try adding the following section to your config file and it should resolve the issue.

HTML
<startup uselegacyv2runtimeactivationpolicy="true">
  <supportedruntime version="v4.0" />
</startup>
 
Share this answer
 
v3
Comments
Sanket Khadke 28-Aug-15 5:32am    
Perfect..:)
connect ashish yadav 19-Apr-17 11:39am    
Works for me.
Thanks.
in your application config file change this section:

<pre lang="HTML">
<startup><supportedruntime version="v4.0" sku=".NETFramework,Version=v4.0">


to

HTML
<startup>useLegacyV2RuntimeActivationPolicy="true"><supportedruntime version="v4.0" sku=".NETFramework,Version=v4.0" /></startup>
 
Share this answer
 
'file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll'


In this link which "/" "\" symbole you use. Before C: / and after C: \.
 
Share this answer
 
v2
You can use this code. Which is working in vs2005 so it may be work in 2010.

VB
Dim rpt As New ReportDocument()
Dim DPath As String = Application.StartupPath & "\MyData.mdb" 'Data File location
rpt.Load(Application.StartupPath & "\Reports\rptInvoice.rpt") 'Report Path
For Each connection As IConnectionInfo In rpt.DataSourceConnections
    'Changing Data Source
    rpt.DataSourceConnections(connection.ServerName, connection.DatabaseName).SetConnection(DPath, "", "", "")
Next
rpt.RecordSelectionFormula = "{InvoiceReport.JobListID}=" & JobAndTrackingMDI.GetJobID & ""
If (rpt.Rows.Count <= 0) Then
    MsgBox("Record does not Exists.")
    Exit Sub
End If
rpt.Refresh()
CRVInvoice.ReportSource = rpt


This Change DataBase Location to your location DPath. So that you can solve database location error. And Solve your Problem.

Thank You.
 
Share this answer
 
Comments
raviprajapat 25-May-11 9:04am    
i using database on other server.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900