cancel
Showing results for 
Search instead for 
Did you mean: 

No valid report source is available

Former Member
0 Kudos

I originally posted this as a reply to another thread covering the same issue (http://forums.sdn.sap.com/edit!default.jspa?messageID=11112925), but then realized that question was already flagged as answered so post it as a new question so it will get more visibility. I'm encountering this same issue in VS2010 when trying to page through my report output, but the solution proposed in the other thread was not helpful to me. I'll provide the relevant code below.

My page markup:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="RunReport.aspx.cs" Inherits="FinancialReporting.RunReport" %>
<%@ Register assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <a href="Default.aspx">Back to Reports List</a>
    <br />
    <asp:HyperLink ID="lnkParameters" NavigateUrl="Parameters.aspx" Text="Back to Parameters Page" runat="server"></asp:HyperLink>
    <br /><br />
    <CR:CrystalReportSource ID="crsource1" runat="server">
    </CR:CrystalReportSource>
    <CR:CrystalReportViewer ID="crviewer1" runat="server" ReportSourceID="crsource1" AutoDataBind="true" />
</asp:Content>

Snippets from code-behind:

protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string filename = GetReportFileName();

                if (filename != string.Empty)
                    ConfigureCrystalReports(filename);
            }
        }

        private void ConfigureCrystalReports(string ReportFile)
        {
            // Set Crystal report source
            CrystalDecisions.Web.Report cr = new CrystalDecisions.Web.Report();
            cr.FileName = Server.MapPath(ReportFile);
            this.crsource1.Report = cr;
                        
            // Apply report parameters
            ParameterFields pfs = SetParameters();
            this.crviewer1.ParameterFieldInfo = pfs;

            // Set other viewer properties
            this.crviewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
            this.crviewer1.EnableDatabaseLogonPrompt = false;

            // Get database logon info from web.config
            CrystalDecisions.Shared.TableLogOnInfo logon = GetReportLogonInfo(Global.MSSQLConnectionString);
            this.crviewer1.LogOnInfo.Add(logon);
        }

What makes this particularly troubling is that this exact same coding technique works in one of my other applications. The only difference I can think of is that in the other application my reports are using Command SQL with the OLEDB provider for the IBM iSeries, while the report in this app is using a table object with the SQLOLEDB provider.

As always, any guidance is appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

I'd take the error "No valid report source is available" at face value. The report engine for some reason is not able to find the report. You don't say if you get the error as soon as you run a report, or after you try to page or try to fire other event(s) (drill, zoom, etc., etc.). If the report 1st page comes up and the issue occurs subsequent to that, then the report is out of scope (e.g.; your PostBack is incorrect). If this happens even before a first page is displayed, I'd take out the PostBack and just as a test, try to run the report without that.

You can also use [Process Monitor|http://technet.microsoft.com/en-ca/sysinternals/bb896645.aspx] to see if you can trace what is happening to the report file.

Oh. And I'd discount the DB diffs for now...

Ludek

Follow us on Twitter http://twitter.com/SAPCRNetSup

Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

Former Member
0 Kudos

The first page of the report loads correctly and the error occurs once I attempt to navigate to the next page. When you suggest that maybe the "Postback is incorrect", I'm not sure what to make of that. This exact same code (with exception of the connection string) works just fine in another app.

Regarding Process Monitor, is there a particular EXE(s) I should filter on to help isolate the issue?

former_member183750
Active Contributor
0 Kudos

This being a web app; W3WP.exe

- Ludek

saurabh_pathak
Active Contributor
0 Kudos

Why do you use CrystalReportSource, when things could be simple using ReportDocument Object model,

I would go for the following approach, but again it needs little modification in your code:

Design page:

<CR:CrystalReportViewer ID="crystalReportViewer" runat="server" AutoDataBind="true" />

Code behind:

ReportDocument northwindCustomersReport = new ReportDocument();
        string reportPath = Server.MapPath("NorthwindCustomers.rpt");
        northwindCustomersReport.Load(reportPath);
        crystalReportViewer.ReportSource = northwindCustomersReport;

Its simple and removes unwanted piece of code as well.

- Saurabh

Former Member
0 Kudos

Saurabh, thanks for the suggestion, but I'm getting exactly the same behavior when I try your approach (which, BTW, only saved me one line in code-behind and one tag in the markup).

saurabh_pathak
Active Contributor
0 Kudos

Run the [Fiddler|http://www.fiddlertool.com/fiddler/] and look for the path of the report.

As suggested by Ludek, run the ProcMon and check if you have permission issues / file does not exist.

- Saurabh

Former Member
0 Kudos

I did download ProcMon, but so far I haven't figured out how to get any value out of it. W3WP.exe never shows up in the list when I'm launching the report, . As for permission or "file doesn't exist" issues, I don't see how either of those could be applicable either since, as I already explained, the report is found and it does run, but when I try to navigate to the next page of output I get this error message.

My next debugging effort is to create a brand new test web app and include both reports, the one from the other app which gives me no problems and this new one, and run them through the same code to see if I still get different behavior.

saurabh_pathak
Active Contributor
0 Kudos

Before you try new app just give it a shot to using session for storing the report's object as per

http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/24380

- Saurabh

Former Member
0 Kudos

Yesterday, I had already begun trying the approach of saving the ReportDocument to the Session object and then on each postback pulling it out from there. And the results were exactly as the first commenter on your link stated, it won't go past page 2, but you can go to the last page and back to the first page (I suppose that is SOME progress).

I have already put my test app together and indeed my original report (the one using Command SQL against the iSeries db) still works and allows me to navigate through all the pages without messing with the Session object, while my new report (which uses table objects and MS-SQL) still doesn't work, although what's happening now is that when try to go to page 2, it prompts me to re-enter the two Date parameters. Further experimentation reveals that if I use Number or String parameters, the paging works fine, so I think I'm on to something. I'm setting these parameters like this:

pf = CreateParameterField("BeginDate", "2/1/2012");

I also tried passing an actual DateTime as the parameter value...

pf = CreateParameterField("BeginDate", new DateTime(2012, 2, 1));

... but this just caused some bizarre javascript error to occur. So what is the correct way to set date parameter values?

Former Member
0 Kudos

Another peculiarity that may be worth noting is that when I coded the record selection formula, for some reason Crystal interprets my MS-SQL 2008 DATE column as a string, so I have to code it like this:

Date({Customer.NextServiceDate}) >= {?BeginDate}
    and
    Date({Customer.NextServiceDate}) <= {?EndDate}

Is there a known Crystal issue with the DATE data type?

Former Member
0 Kudos

Further investigation has revealed what I can only interpret as a bug. What I've found is that when a postback is triggered by the Next Page action, the CrystalReportViewer's ParameterFieldInfo collection fails to retain the parameter values for any parameters of types Date or DateTime (they become null). As soon as I substitute these parameters for String or Number types, paging works just fine. Apparently this is the essential difference in the behavior of my reports I described between the two applications; the reports in the former app did not utilize Date/DateTime parameters.

I'm sure I can devise a workaround using String and/or Number parameters, but this is something that should be looked into assuming it's not already a known issue.

Answers (0)