cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Crystal Reports for .NET in Windows 7

Former Member
0 Kudos

Hi,

We were using VB.NET 2010 and CR 11.5 in our current PC and it works fine. We create reports in CR 11.5 and call it in VB.NET 2010. It worked fine so far in our PC and in Users PC.

We were asked to test the application in Windows 7 and the CR failed. I read lot of forums and it said that the following DLL's does not work in Windows 7 with VB.NET 2010.

Interop.CRAXDDRT.dll

Interop.CRAXDRT.dll

AxInterop.CrystalActiveXReportViewerLib11.dll

So we got CR for .NET 2010 and create a small project with just 1 screen that calls the CR that was created in 11.5, but the viewer we used in the project is from the CR for .NET 2010. I included the following reference in the Project

CrystalDecisions.CrystalReports. Engine

CrystalDecisions.CrystalReports. Design

CrystalDecisions.ReportSource

CrystalDecisions.Shared

CrystalDecisions.Windows.Form

When I created a setup package to install in Windows 7.0, it did not put any Crystal reports DLL in the setup package. After installation, the project did not work and it gave me error. Also the Runtime files for CR for .NET is installed in Windows 7 before the Project was installed.

HEre is the code:

    Public Sub OpenCrystalReport(ByRef ReportName As String, ByRef ReportPath As String, ByVal param As String)

        Dim objReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
        Dim ConInfo As New CrystalDecisions.Shared.TableLogOnInfo
        Dim paraValue As New CrystalDecisions.Shared.ParameterDiscreteValue
        Dim currValue As CrystalDecisions.Shared.ParameterValues
        Dim mySubReportObject As CrystalDecisions.CrystalReports.Engine.SubreportObject
        Dim mySubRepDoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument

        Dim intCounter As Integer
        Dim index As Integer
        Dim strParValPair() As String
        Dim strVal() As String

        objReport.Load(ReportPath & ReportName)
        intCounter = objReport.DataDefinition.ParameterFields.Count

        'As parameter fields collection also picks the selection formula which is not the parameter
        'so if total parameter count is 1 then we check whether its a parameter or selection formula.
        If intCounter = 1 Then
            If InStr(objReport.DataDefinition.ParameterFields(0).ParameterFieldName, ".", CompareMethod.Text) > 0 Then
                intCounter = 0
            End If
        End If

        'apply parameters to the report
        If intCounter > 0 And Trim(param) <> "" Then
            strParValPair = param.Split("&")

            For index = 0 To UBound(strParValPair)
                If InStr(strParValPair(index), "=") > 0 Then
                    strVal = strParValPair(index).Split("=")
                    paraValue.Value = strVal(1)
                    currValue = objReport.DataDefinition.ParameterFields(strVal(0)).CurrentValues
                    currValue.Add(paraValue)
                    objReport.DataDefinition.ParameterFields(strVal(0)).ApplyCurrentValues(currValue)
                End If
            Next
        End If

        ConInfo.ConnectionInfo.ServerName = "ELTTMSQBES01"
        ConInfo.ConnectionInfo.DatabaseName = "absolution_prod"

        For intCounter = 0 To objReport.Database.Tables.Count - 1
            objReport.Database.Tables(intCounter).ApplyLogOnInfo(ConInfo)
        Next

        ' Loop through each section on the report then look through each object in the section
        ' if the object is a subreport, then apply logon info  on each table of that sub report
        For index = 0 To objReport.ReportDefinition.Sections.Count - 1
            For intCounter = 0 To objReport.ReportDefinition.Sections(index).ReportObjects.Count - 1
                With objReport.ReportDefinition.Sections(index)
                    If .ReportObjects(intCounter).Kind = CrystalDecisions.Shared.ReportObjectKind.SubreportObject Then
                        mySubReportObject = CType(.ReportObjects(intCounter), CrystalDecisions.CrystalReports.Engine.SubreportObject)
                        mySubRepDoc = mySubReportObject.OpenSubreport(mySubReportObject.SubreportName)
                        For intCounter1 = 0 To mySubRepDoc.Database.Tables.Count - 1
                            mySubRepDoc.Database.Tables(intCounter1).ApplyLogOnInfo(ConInfo)
                            mySubRepDoc.Database.Tables(intCounter1).ApplyLogOnInfo(ConInfo)
                        Next
                    End If
                End With
            Next
        Next

        'Re setting control
        CRViewer1.ReportSource = Nothing

        'Set the current report object to report.
        CRViewer1.ReportSource = objReport

        'Show the report
        CRViewer1.Show()
    End Sub

The error is

The error is: Could not load file or assembly "CrystalDecisions.Windows.Forms, Version 13.0.2000.0, culture = neutral, PublicKeyToken=692fbea5521e1304" or one of it components. The system cannot find the files specified.

Am I suppossed to include any files in the setup project?? Am I missing something?? Please help. I am unable to proceed in Windows 7 now....

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Error msg is look's like as crystal report runtime varsion have some issue "CrystalDecisions.Windows.Forms, Version 13.0.2000.0" is it correct dll. please make sure that, and also make sure that if u'r appliction in runing on "32 bit then u required 32 bit runtime(CRRuntime_32bit_13_0_4.msi)" or "if it's 64 bit then it's required 64bit runtime(CRRuntime_64bit_13_0_4.msi)"

you can see the correct dll varsion of runtime at this location .> "C:\Windows\assembly"

thanks,

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks Nithesh and Ludek.

I installed the runtime engine and now able to see the correct version of the DLLS under c:\windows\assembly\ folder.

Now the application gives different error.

The error is: Method not found: "Void CrystalDecisions.Windows.Forms,CrystalReportViewer.set_showCopyButton(Boolean)".

Am I doing somehting wrong in my code??

former_member183750
Active Contributor
0 Kudos

Beatrice, how did you install the runtime engine?

Assuming this works on your development computer, code should not have anything to do with the error.

- Ludek

Former Member
0 Kudos

Beatrice,

before install new reuntime, Please make sure that all instance old runtime is deleted properly,

If u want to make sure, please check the business object or SAP regesitry,

and make sure in C.

Thnaks,

former_member183750
Active Contributor
0 Kudos

Nitesh is correct. You are missing the CR runtime. E.g.; you can not deploy the runtime without using either the merge modules or MSI file. This link will get you to the downloads:

http://scn.sap.com/docs/DOC-7824

- Ludek

Follow us on Twitter

Got Enhancement ideas? Try the SAP Idea Place

Share Your Knowledge in SCN Topic Spaces