Web Hosting Community Forums by ASPnix
Client Login Area
LiveZilla Live Chat Software
Results 1 to 10 of 10

Thread: Crystal Reports Deployment

  1. #1
    Junior Member
    Join Date
    December 8, 2009
    Location
    Manchester, UK
    Posts
    9

    Default Crystal Reports Deployment

    Hi,

    I have a couple of Crystal Reports I would like to publish on my website. I have a Portal account and one of the features from ASPNix is Crystal Reports Runtime for .Net 4.

    My code for creating the report is below (just printing straight to pdf)..

    I have these assemblies in the web.config
    Code:
            <add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
            <add assembly="CrystalDecisions.Shared, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
    These are also in there but commented out
    Code:
           <!--
            <add assembly="CrystalDecisions.ReportSource, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
            <add assembly="CrystalDecisions.ReportAppServer.CommLayer, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
            -->
    they are commented out because I get error messages if the are uncommented.

    Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.

    If I leave them uncommented, when I try and open the page with the reports I get..
    Code:
    Could not load file or assembly 'CrystalDecisions.ReportSource, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
    Code:
    Imports CrystalDecisions.Shared
    Imports CrystalDecisions.CrystalReports.Engine
    
    Partial Class admin_admin_reports
        Inherits System.Web.UI.Page
    
        Dim rep As New ReportDocument
    
        Private Sub BindReport(ByVal reportName As String)
    
            If Session("Rep") Is Nothing Then
    
                Dim ConnInfo As New ConnectionInfo
    
                With ConnInfo
                    .ServerName = "mssql1.anaxanet.eu"
                    .DatabaseName = ""
                    .UserID = ""
                    .Password = ""
                End With
    
                rep.Load(Server.MapPath(reportName))
    
                Dim RepTbls As Tables = rep.Database.Tables
    
                For Each RepTbl As Table In RepTbls
    
                    Dim RepTblLogonInfo As TableLogOnInfo = RepTbl.LogOnInfo
    
                    RepTblLogonInfo.ConnectionInfo = ConnInfo
                    RepTbl.ApplyLogOnInfo(RepTblLogonInfo)
    
                Next
    
                rep.Refresh()
    
                Session("Rep") = rep
    
            Else
                rep = CType(Session("Rep"), ReportDocument)
    
            End If
    
        End Sub
    
        Protected Sub btnPrintLeagueTablesReport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrintLeagueTablesReport.Click
    
            Session("Rep") = Nothing
            BindReport("../Reports/LeagueTables.rpt")
            rep.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "LeagueTables")
    
        End Sub
    
        Protected Sub btnPrintNotPlayedReport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrintNotPlayedReport.Click
    
            Session("Rep") = Nothing
            BindReport("../Reports/NotPlayed.rpt")
            rep.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "PlayersNotPlayed")
    
        End Sub
    
    End Class
    Any help will be appreciated.

    Thanks, Mark
    Last edited by Mark; March 10th, 2012 at 02:44 AM.

  2. #2
    Administrator Chris's Avatar
    Join Date
    October 11, 2008
    Location
    Aubrey, Tx
    Posts
    742

    Default

    Mark,

    Can you please PM me your account name / domain name so we can determine which server you are on.

    Thanks!
    Christopher York
    ASPnix Operations Manager
    877-427-7649 ext 128
    chris@aspnix.com

  3. #3
    Junior Member
    Join Date
    December 8, 2009
    Location
    Manchester, UK
    Posts
    9

    Default

    Ok, done.

    One point to note is that it does say Crystal for .Net 4 however I could not get any of the Crystal 13.02 assemblies to load.. But I had limited success with the 10.2 versions.

  4. #4
    Administrator Chris's Avatar
    Join Date
    October 11, 2008
    Location
    Aubrey, Tx
    Posts
    742

    Default

    Mark,

    Assembles build v13.0.2000.0 are installed in our GAC for .NET 4.0 x64.
    Christopher York
    ASPnix Operations Manager
    877-427-7649 ext 128
    chris@aspnix.com

  5. #5
    Junior Member
    Join Date
    December 8, 2009
    Location
    Manchester, UK
    Posts
    9

    Default

    Hi Chris,

    I have now upgraded my references in web.config to..
    Code:
            <add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
            <add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
            <add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
            <add assembly="CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
    and the website has no problem with it.

    I now go to the report page (same code) and get
    Compilation Error
    'ReportDocument' is ambiguous in the namespace 'CrystalDecisions.CrystalReports.Engine'
    Code:
    Line 5:      Inherits System.Web.UI.Page
    Line 6:  
    Line 7:      Dim rep As New CrystalDecisions.CrystalReports.Engine.ReportDocument
    It works fine locally for me.

  6. #6
    Administrator Chris's Avatar
    Join Date
    October 11, 2008
    Location
    Aubrey, Tx
    Posts
    742

    Default

    Mark,

    Unfortunately this is outside our scope / support. Seems like the class ReportDocument is defined in the above namespace and another namespace you declared. I would recommend removing the .Engine namespace (or the other) and seeing if this fixes it.

    You are importing 2 namespaces that both have ReportDocument defined.
    Christopher York
    ASPnix Operations Manager
    877-427-7649 ext 128
    chris@aspnix.com

  7. #7
    Junior Member
    Join Date
    December 8, 2009
    Location
    Manchester, UK
    Posts
    9

    Default

    Hi Chris,

    To be fair that's what I thought a while ago but that is not the problem.. The ReportDocument class only belongs to the namspace CrystalDecisions.CrystalReports.Engine.

    It runs fine here (I know thats no proof), but it compiles fine, and runs.

    I think it is a problem with the installation of Crystal or multiple installations in the GAC.

    I have only 2 references in the web.config now, although I don't think this was a problem before..
    Code:
            <add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
            <add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

  8. #8
    Administrator Chris's Avatar
    Join Date
    October 11, 2008
    Location
    Aubrey, Tx
    Posts
    742

    Default

    The GAC only has a single copy of either of those assemblies. I noticed that your Bin directory also contains copies of the assemblies as well.
    Christopher York
    ASPnix Operations Manager
    877-427-7649 ext 128
    chris@aspnix.com

  9. #9
    Junior Member
    Join Date
    December 8, 2009
    Location
    Manchester, UK
    Posts
    9

    Default

    Thats the one Chris.. In my Bin here I had deleted them..

    Nice work, thanks.

    Mark

  10. #10
    Administrator Chris's Avatar
    Join Date
    October 11, 2008
    Location
    Aubrey, Tx
    Posts
    742

    Default

    Mark,

    I am happy we were able to resolve this! I am marking this as solved!
    Christopher York
    ASPnix Operations Manager
    877-427-7649 ext 128
    chris@aspnix.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •