Adi
asked on
Why Crystal Report Opening is failed in Access 2007 application?
I have developed a component in VB.NET Visual Studio 2013.
This Class Library contains Crystal Report.
While testing this Class Library in Win Form application I have get error message:
CrystalDecisions.CrystalRe ports.Engi ne.DataSou rceExcepti on: Failed to load database information.
Error in File temp_e2ac33fe-6dc0-4fcf-b1 f3-997c850 9c545 {97C9C8CE-1590-420A-8BF7-8 EA56100CEA 9}.rpt:
Failed to load database information. ---> System.Runtime.InteropServ ices.COMEx ception: Failed to load database information.
Error in File temp_e2ac33fe-6dc0-4fcf-b1 f3-997c850 9c545 {97C9C8CE-1590-420A-8BF7-8 EA56100CEA 9}.rpt:
Failed to load database information.
at CrystalDecisions.ReportApp Server.Con trollers.D atabaseCon trollerCla ss.Replace Connection (Object oldConnection, Object newConnection, Object parameterFields, Object crDBOptionUseDefault)
at CrystalDecisions.CrystalRe ports.Engi ne.Table.S etDataSour ce(Object val, Type type)
at CrystalDecisions.CrystalRe ports.Engi ne.ReportD ocument.Se tDataSourc eInternal( Object val, Type type)
--- End of inner exception stack trace ---
at CrystalDecisions.ReportApp Server.Con vertDotNet ToErom.Thr owDotNetEx ception(Ex ception e)
at CrystalDecisions.CrystalRe ports.Engi ne.ReportD ocument.Se tDataSourc eInternal( Object val, Type type)
at CrystalDecisions.CrystalRe ports.Engi ne.ReportD ocument.Se tDataSourc e(DataSet dataSet)
at FedexManager.frm_shpDailyM anifest.Sh owManifest (DateTime FromDate, DateTime ToDate)
at FedexManager.clsFedexManag er.GetDail yManifest( Int32 iManifestId)
After adding to app.config file an attribute useLegacyV2RuntimeActivati onPolicy=" true" to startup tag this problem was fixed.
When I use this Class Library in Access application I have getting a similar error message:
CrystalDecisions.CrystalRe ports.Engi ne.DataSou rceExcepti on: Failed to load database information.
Error in File temp_e0f83f2f-078a-432e-90 af-8a6049c 259dd {86154599-8E93-4293-BD42-3 802A288D9B 7}.rpt:
Failed to load database information. ---> System.Runtime.InteropServ ices.COMEx ception: Failed to load database information.
Error in File temp_e0f83f2f-078a-432e-90 af-8a6049c 259dd {86154599-8E93-4293-BD42-3 802A288D9B 7}.rpt:
Failed to load database information.
at CrystalDecisions.ReportApp Server.Con trollers.D atabaseCon trollerCla ss.Replace Connection (Object oldConnection, Object newConnection, Object parameterFields, Object crDBOptionUseDefault)
at CrystalDecisions.CrystalRe ports.Engi ne.Table.S etDataSour ce(Object val, Type type)
at CrystalDecisions.CrystalRe ports.Engi ne.ReportD ocument.Se tDataSourc eInternal( Object val, Type type)
--- End of inner exception stack trace ---
at Microsoft.VisualBasic.Comp ilerServic es.Symbols .Container .InvokeMet hod(Method TargetProcedure, Object[] Arguments, Boolean[] CopyBack, BindingFlags Flags)
at Microsoft.VisualBasic.Comp ilerServic es.NewLate Binding.Ca llMethod(C ontainer BaseReference, String MethodName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, BindingFlags InvocationFlags, Boolean ReportErrors, ResolutionFailure& Failure)
at Microsoft.VisualBasic.Comp ilerServic es.NewLate Binding.Ob jectLateCa ll(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn)
at Microsoft.VisualBasic.Comp ilerServic es.NewLate Binding.La teCall(Obj ect Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn)
at Techsign.Invoices.cls_invc ShipInvoic e.GetShipI nvoice(Int 32 iInvoiceId, String ConnectionString, Int32 VersionType, enInvoiceType InvoiceType, Int32 LanguagePackId).
What I should to do to resolve this problem?
This Class Library contains Crystal Report.
While testing this Class Library in Win Form application I have get error message:
CrystalDecisions.CrystalRe
Error in File temp_e2ac33fe-6dc0-4fcf-b1
Failed to load database information. ---> System.Runtime.InteropServ
Error in File temp_e2ac33fe-6dc0-4fcf-b1
Failed to load database information.
at CrystalDecisions.ReportApp
at CrystalDecisions.CrystalRe
at CrystalDecisions.CrystalRe
--- End of inner exception stack trace ---
at CrystalDecisions.ReportApp
at CrystalDecisions.CrystalRe
at CrystalDecisions.CrystalRe
at FedexManager.frm_shpDailyM
at FedexManager.clsFedexManag
After adding to app.config file an attribute useLegacyV2RuntimeActivati
When I use this Class Library in Access application I have getting a similar error message:
CrystalDecisions.CrystalRe
Error in File temp_e0f83f2f-078a-432e-90
Failed to load database information. ---> System.Runtime.InteropServ
Error in File temp_e0f83f2f-078a-432e-90
Failed to load database information.
at CrystalDecisions.ReportApp
at CrystalDecisions.CrystalRe
at CrystalDecisions.CrystalRe
--- End of inner exception stack trace ---
at Microsoft.VisualBasic.Comp
at Microsoft.VisualBasic.Comp
at Microsoft.VisualBasic.Comp
at Microsoft.VisualBasic.Comp
at Techsign.Invoices.cls_invc
What I should to do to resolve this problem?
ASKER
1. I'm using last version of Crystal Report for Visual Studio 2013 (v. 13.0.9.1312).
The report is developed in Visual Studio 2013 as Class Library.
2. I'm using accdb (accde) as GUI.
Data is stored in SQL Server.
The report is developed in Visual Studio 2013 as Class Library.
2. I'm using accdb (accde) as GUI.
Data is stored in SQL Server.
Can you open reports in the VS IDE from the database?
Did you install the MS Office ODBC connections for Office 20xx?
I don't know about the licensing for that version of Crystal and VS but it may be you can't call it from another application.
mlmcc
Did you install the MS Office ODBC connections for Office 20xx?
I don't know about the licensing for that version of Crystal and VS but it may be you can't call it from another application.
mlmcc
ASKER
I can open reports in the VS IDE.
More of that I have created Win Form application for testing this Class Library, and Report is opened correctly when I run executable Test application.
It's working when app.config contains useLegacyV2RuntimeActivati onPolicy=" true" attribute
.......
<startup useLegacyV2RuntimeActivati onPolicy=" true"><sup portedRunt ime version="v4.0" sku=".NETFramework,Version =v4.0"/></ startup>
Without useLegacyV2RuntimeActivati onPolicy=" true" attribute the problem exists in WinForm Test application also.
Our Access application don't need ODBC connection: a connection string is stored in Windows Registry.
Class Library object has connection string property.
The problem exists on the development computer. My test application is another application also. It's working without any license.
More of that I have created Win Form application for testing this Class Library, and Report is opened correctly when I run executable Test application.
It's working when app.config contains useLegacyV2RuntimeActivati
.......
<startup useLegacyV2RuntimeActivati
Without useLegacyV2RuntimeActivati
Our Access application don't need ODBC connection: a connection string is stored in Windows Registry.
Class Library object has connection string property.
The problem exists on the development computer. My test application is another application also. It's working without any license.
Applications developed in VS using the VS version of Crystal do NOT have a licensing issue. It is the calling the reports from MS Access that I question.
How are you connecting the report to the database?
Crystal maintains its own connection to the database so even when you are in MS Access the report needs its own connection. How are you setting the database connection to the report from the Access application? Is it handled in the class you built?
mlmcc
How are you connecting the report to the database?
Crystal maintains its own connection to the database so even when you are in MS Access the report needs its own connection. How are you setting the database connection to the report from the Access application? Is it handled in the class you built?
mlmcc
ASKER
Hi mlmcc,
The report hasn't any own connection to the database.
I'm using dataset as datasource for the report.
The report hasn't any own connection to the database.
I'm using dataset as datasource for the report.
What code are you using to pass the recordset to the report?
Your error indicates the report is trying to open the database.
mlmcc
Your error indicates the report is trying to open the database.
mlmcc
ASKER
Hi mlmcc,
This is a code:
Public Sub GetShipInvoice(ByVal iQuoteId As Integer, ByVal ConnectionString As String, ByVal VersionType As Integer)
Dim dsShipInvoice As dsShipInvoice = New dsShipInvoice
Dim rw As frm_rptReportViewer = New frm_rptReportViewer
Dim rpt As rpt_shpInvoice = New rpt_shpInvoice
Try
Dim m_iShipToId As Integer = Data.DLookup(ConnectionStr ing, "ShipID", "tbl_qteQuotes", "QuoteID=" & iQuoteId)
Dim m_iBillToId As Integer = Data.DLookup(ConnectionStr ing, "ContactID", "tbl_qteQuotes", "QuoteID=" & iQuoteId)
Dim m_strCountry As String = Data.DLookup(ConnectionStr ing, "Country", "tbl_cntContacts", "SerNum=" & m_iShipToId)
Try
GetCompanyInfoDataTable(Co nnectionSt ring, dsShipInvoice.tblIcons)
Data.FillDataTable(Connect ionString, "Select * from udf_qte_shpInvoiceDetails( " & iQuoteId & ")", dsShipInvoice.udf_qte_shpI nvoiceDeta ils)
Data.FillDataTable(Connect ionString, "Select * from tbl_qteInvoice WHERE QuoteID=" & iQuoteId, dsShipInvoice.tbl_qteInvoi ce)
Data.FillDataTable(Connect ionString, "Select * from tbl_qteQuotes WHERE QuoteID=" & iQuoteId, dsShipInvoice.tbl_qteQuote s)
Data.FillDataTable(Connect ionString, "SELECT TOP 1 IT.* FROM tbl_qteQuotes Q INNER JOIN tbl_qteIncoTerms IT ON Q.IncoTerms = IT.TermType WHERE Q.QuoteID=" & iQuoteId, dsShipInvoice.tbl_qteIncoT erms)
Data.FillDataTable(Connect ionString, "SELECT P.* FROM tblPayment P INNER JOIN tbl_qteQuotes Q ON P.PayMent = Q.PayMent WHERE Q.QuoteID=" & iQuoteId, dsShipInvoice.tblPayment)
GetContact(ConnectionStrin g, m_iShipToId, dsShipInvoice.tbl_cntShipT o)
GetContact(ConnectionStrin g, m_iBillToId, dsShipInvoice.tbl_cntConta cts)
Catch ex As Exception
Exceptions.PrintErrorToLog ("GetShipI nvoice-1", ex.ToString)
End Try
rpt.SetDataSource(dsShipIn voice)
Dim objDeclaration As CrystalDecisions.CrystalRe ports.Engi ne.Formula FieldDefin ition = rpt.DataDefinition.Formula Fields("tx tDeclarati on")
objDeclaration.Text = "'" + GetDeclaration(m_strCountr y).Replace (vbCrLf, "' + chr(10) + '") + "'"
objDeclaration = Nothing
Dim objRefNo As CrystalDecisions.CrystalRe ports.Engi ne.TextObj ect = rpt.Section1.ReportObjects .Item("txt RefNo")
objRefNo.Text = GetRefNo(ConnectionString, iQuoteId, VersionType)
objRefNo = Nothing
If VersionType <> 0 Then
Dim objStamp As CrystalDecisions.CrystalRe ports.Engi ne.Picture Object = rpt.Section10.ReportObject s("picTech SignStamp" )
objStamp.Width = 0
objStamp.Height = 0
objStamp = Nothing
End If
Try
Dim bEUR As Boolean = Misc.nz(Data.FirstRow(Conn ectionStri ng, "EXEC dbo.sp_cntIsEUR '" & m_strCountry & "'")("EUR"), False)
If Not bEUR Then
Dim objStamp As CrystalDecisions.CrystalRe ports.Engi ne.Picture Object = rpt.Section4.ReportObjects ("picEUR1S tamp")
objStamp.Width = 0
objStamp.Height = 0
objStamp = Nothing
End If
Catch ex As Exception
Exceptions.PrintErrorToLog ("GetShipI nvoice", "Missing Countries Table: " & ex.ToString)
Dim objStamp As CrystalDecisions.CrystalRe ports.Engi ne.Picture Object = rpt.Section4.ReportObjects ("picEUR1S tamp")
objStamp.Width = 0
objStamp.Height = 0
objStamp = Nothing
End Try
Try
With rw
.crvMain.ToolPanelView = CrystalDecisions.Windows.F orms.ToolP anelViewTy pe.None
.crvMain.ReportSource = rpt
.ShowDialog()
End With
Catch ex As Exception
MsgBox(ex.ToString)
Exceptions.PrintErrorToLog ("GetShipI nvoice-2", ex.ToString)
End Try
Catch ex As Exception
Exceptions.PrintErrorToLog ("GetShipI nvoice-3", ex.ToString)
Finally
rpt.Dispose()
rpt = Nothing
rw.Dispose()
rw = Nothing
dsShipInvoice.Dispose()
dsShipInvoice = Nothing
End Try
End Sub
Thanks
This is a code:
Public Sub GetShipInvoice(ByVal iQuoteId As Integer, ByVal ConnectionString As String, ByVal VersionType As Integer)
Dim dsShipInvoice As dsShipInvoice = New dsShipInvoice
Dim rw As frm_rptReportViewer = New frm_rptReportViewer
Dim rpt As rpt_shpInvoice = New rpt_shpInvoice
Try
Dim m_iShipToId As Integer = Data.DLookup(ConnectionStr
Dim m_iBillToId As Integer = Data.DLookup(ConnectionStr
Dim m_strCountry As String = Data.DLookup(ConnectionStr
Try
GetCompanyInfoDataTable(Co
Data.FillDataTable(Connect
Data.FillDataTable(Connect
Data.FillDataTable(Connect
Data.FillDataTable(Connect
Data.FillDataTable(Connect
GetContact(ConnectionStrin
GetContact(ConnectionStrin
Catch ex As Exception
Exceptions.PrintErrorToLog
End Try
rpt.SetDataSource(dsShipIn
Dim objDeclaration As CrystalDecisions.CrystalRe
objDeclaration.Text = "'" + GetDeclaration(m_strCountr
objDeclaration = Nothing
Dim objRefNo As CrystalDecisions.CrystalRe
objRefNo.Text = GetRefNo(ConnectionString,
objRefNo = Nothing
If VersionType <> 0 Then
Dim objStamp As CrystalDecisions.CrystalRe
objStamp.Width = 0
objStamp.Height = 0
objStamp = Nothing
End If
Try
Dim bEUR As Boolean = Misc.nz(Data.FirstRow(Conn
If Not bEUR Then
Dim objStamp As CrystalDecisions.CrystalRe
objStamp.Width = 0
objStamp.Height = 0
objStamp = Nothing
End If
Catch ex As Exception
Exceptions.PrintErrorToLog
Dim objStamp As CrystalDecisions.CrystalRe
objStamp.Width = 0
objStamp.Height = 0
objStamp = Nothing
End Try
Try
With rw
.crvMain.ToolPanelView = CrystalDecisions.Windows.F
.crvMain.ReportSource = rpt
.ShowDialog()
End With
Catch ex As Exception
MsgBox(ex.ToString)
Exceptions.PrintErrorToLog
End Try
Catch ex As Exception
Exceptions.PrintErrorToLog
Finally
rpt.Dispose()
rpt = Nothing
rw.Dispose()
rw = Nothing
dsShipInvoice.Dispose()
dsShipInvoice = Nothing
End Try
End Sub
Thanks
Was the report originally written using a database connection as the data source?
mlmcc
mlmcc
ASKER
No.
The dataset item was created in the VS project on the base of tables and udf's of a real database.
The report was created with this dataset as data source.
Thanks
The dataset item was created in the VS project on the base of tables and udf's of a real database.
The report was created with this dataset as data source.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have find the solution with the help of SAP Community Network expert Ludek Uher.
Only versions before CR 2008 have an SDK that can be used with applications like MS Access.
Are you using an mdb or accdb?
Most versions of Crystal cannot use an aacdb as the data source.
mlmcc