Solved Crystal Viewer Problems

Posted on 2005-05-03
Last Modified: 2010-05-18

i copied my locally developed project onto a remote server. I also installed crystal reports onto the server. I have a site that allows the user to choose a report from a drop down list, and opens the corresponding report in a new window using a crystal viewer. the reports dont open when being run from the server, i get the little javascript error that shows up in the bottom left corner of IE. (The project runs perfectly when being tested on the local machine it was developed on)

Line: 84
Char: 3
Error: Object Expected
Code: 0
URL: http://localhost/crystalViewer/report.aspx

It can make it to prompting for the parameters, but when i submit these parameters it doesnt do anything

heres my code

Imports System.Data
Imports CrystalDecisions
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports
Imports CrystalDecisions.CrystalReports.Engine
Imports System.Data.SqlClient
Public Class report
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents crvReports As CrystalDecisions.Web.CrystalReportViewer
    Protected WithEvents Image1 As System.Web.UI.WebControls.Image
    Protected WithEvents Label3 As System.Web.UI.WebControls.Label

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim query, table, table2, dept_id, temp, department, report As String, count, i As Integer
        report = Session("report")
        query = "select filename from reports where alias = '" & report & "'"
        table = "departments"
        department = Session("department")
        Dim myConnection As SqlConnection = New SqlConnection
        Dim connstring As String
        connstring = ConfigurationSettings.AppSettings("ConnectionString2")
        myConnection.ConnectionString = connstring
        Dim myAdapter As New SqlDataAdapter(query, myConnection)
        Dim myDS As New DataSet
            myAdapter.Fill(myDS, table)
        Dim crReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
        crReportDocument.Load(Request.MapPath("~/Reports/") & RTrim(department) & "\" & RTrim(myDS.Tables(table).Rows(0).Item(0)))
        crvReports.ReportSource = crReportDocument

            crvReports.DisplayGroupTree = False

            crvReports.EnableParameterPrompt = True
        Catch errorName As Exception
            'lblError.Text = errorName.Message
        End Try
    End Sub
End Class


Question by:JHankinson
    LVL 9

    Expert Comment

    Hi JHankinson,

      If the code works and its a javascript error, do you have the alias for the activex viewer setup? Otherwise the code looks fine.


    Author Comment

    im not sure, how do i check or set it up if its not?
    it looks like a javascript error anyway, i havent coded in javascript in this project though

    Author Comment

    another point that might help:

    i can view reports that dont require parameters ok, but when i open them all of the crystal viewer controls are "crossed" out.

    LVL 9

    Accepted Solution

    No but the activeX object for the viewer obviously does.

    With the site that works, check all the vitual directories of IIS and make sure that the permissions for the activeX is correct as well.

    Author Comment

    i cant find anything to do with activeX in any of the permissions for the working version of the project
    how do i check if its ok? or could it be something else?
    LVL 8

    Assisted Solution

    cyber is right.  You can try installing the "Crystal Reports for Visual Studio .NET Server Install", which I believe creates the virtual directory for you.

    Author Comment

    ok i installed that program, whats the next step from here? im a bit confused

    Author Comment

    i was looking around in IIS and i looked under the default web site (which is stopped) (my site is not the default one, its actually running from the D:\ and not the C:\) there are folders for crystalreportviewers10. Does my website need this folder in its root dir?

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
    Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now