?
Solved

CRViewer displaying The report filename was empty.

Posted on 2011-02-25
4
Medium Priority
?
3,045 Views
Last Modified: 2012-05-11
Thanks in advance for any input.
CRViewer is displaying The report filename was empty althought the report gets displayed accordingly.
I'm running a crystal report within VB.NET and using CRViewer to display the report.
Please at code and error message.


ASPX CODE:
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPagePep.master" AutoEventWireup="false"
    CodeFile="reportsCrystal.aspx.vb" Inherits="reportsCrystal" %>

<%@ Register Assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div style="text-align: left; padding: 10px 0 10px 10px">
        <input id="btnBack" class="ButtonSmall" type="button" value="Back" onclick="javascript:history.back();" />
        <asp:Label ID="lblError" runat="server" Text="" ForeColor="Red"></asp:Label>
    </div>
    <div>
        <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true"
            ReportSourceID="CrystalReportSource1" ToolPanelWidth="1px" />
        <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
        </CR:CrystalReportSource>
    </div>
</asp:Content>





VB CODE:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Web
Imports CrystalDecisions.ReportSource
Imports System.Data
Imports System.Data.SqlClient
Imports CrystalDecisions.Reporting.WebControls
Imports System.IO

Partial Class reportsCrystal
    Inherits System.Web.UI.Page

    Dim _rpt As String = ""
    Dim _id As String = ""
    Protected timeout As Integer

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        getReport()

    End Sub

    Public Sub getReport()
        Try
            _rpt = Request.QueryString("rpt")
            _id = Request.QueryString("id")

            Dim objConn1 As New SqlConnection
            Dim oCom As New SqlCommand
            Dim dr As SqlDataReader

            objConn1.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("ConnDB")
            oCom.Connection = objConn1
            objConn1.Open()
            oCom.CommandText = "sp_portal_CrystalReportUserAccessGet"
            oCom.CommandType = CommandType.StoredProcedure
            oCom.Parameters.Add(New SqlParameter("@userName", SqlDbType.NVarChar)).Value = Session("userName")
            oCom.Parameters.Add(New SqlParameter("@reportId", SqlDbType.Int)).Value = _id
            oCom.CommandTimeout = 150000
            dr = oCom.ExecuteReader

            If dr.Read Then
                If Session("userName") = dr("username") And _rpt = dr("reportName") Then
                    CrystalReportSource1.Report.FileName = "~/reportsCrystal/" & _rpt
                    lblError.Text = ""
                    CrystalReportViewer1.ViewTimeSelectionFormula = ""                  
                Else
                    lblError.Text = "Report access = 'NONE'"
                End If
            Else
                lblError.Text = "Report access = 'NONE'"
            End If
            objConn1.Close()
        Catch ex As Exception
            lblError.Text = ex.Message
        End Try
    End Sub
End Class

Open in new window

crystalerror.bmp
0
Comment
Question by:rborda
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 17

Expert Comment

by:MIKE
ID: 34987887
What is the "REPORT NAME",....I don't see it in your code.....???
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 34988781
Look at this dialog from Crystal

http://forums.sdn.sap.com/thread.jspa?threadID=1355735

mlmcc
0
 

Author Comment

by:rborda
ID: 34997009
Hi CRXIuser2005:

The report name is passed thru the following field named _rpt  line 50 in the code

0
 

Author Closing Comment

by:rborda
ID: 34997799
Thank you mlmcc for the link provided. I want to clarify what helped me from the link.  Using the Page_Init instead of the page_Load to declare the path as indicated on the documentation.   Thank you again!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month9 days, 20 hours left to enroll

762 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