Print Page | Close Window

"Load Report Failed" - Not Everytime

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=11477
Printed Date: 30 Apr 2024 at 2:00am


Topic: "Load Report Failed" - Not Everytime
Posted By: _charles
Subject: "Load Report Failed" - Not Everytime
Date Posted: 20 Oct 2010 at 10:34am
Hello,
 
I am using Visual Studio 2008 and SQL Server 2008
 
I have added a CR using the report wizard that connects to a simple stored procedure with 3 params. When I run the report I get a pop up indicating that the "Load report failed". I then cancel out of the "Enter Parameter Values" and on the 2nd try the report loads correctly (sometimes it taskes 2 or 3 times). I am guessing that I have something configured incorrectly but not sure what - here is the code used to call the report:
 
CrystalReportViewer1.ReportSource = New ActivitiesReport

Dim field1 As ParameterField = Me.CrystalReportViewer1.ParameterFieldInfo(0)

Dim field2 As ParameterField = Me.CrystalReportViewer1.ParameterFieldInfo(1)

Dim field3 As ParameterField = Me.CrystalReportViewer1.ParameterFieldInfo(2)

Dim val1 As New ParameterDiscreteValue()

Dim val2 As New ParameterDiscreteValue()

Dim val3 As New ParameterDiscreteValue()

Dim employee As String = GetSystemEmployeeName()

val1.Value = employee

val2.Value = calBeginDate.Value

val3.Value = calEndDate.Value

field1.CurrentValues.Add(val1)

field2.CurrentValues.Add(val2)

field3.CurrentValues.Add(val3)

 
Any help would be greatly appreciated - especially a link to a Best Practices tutorial involving programatically loading CR's with parameters!! I remember when I was in college 8 years ago CR Best Practice examples were readily available from both MS and Crystal Reports.



Replies:
Posted By: hilfy
Date Posted: 22 Oct 2010 at 5:50am
I use this site as a reference:  http://devlibrary.businessobjects.com/BusinessObjectsXIR2/en/devsuite.htm - http://devlibrary.businessobjects.com/BusinessObjectsXIR2/en/devsuite.htm .  However, this is an old BusinessObjects site and there's no telling how long SAP will keep it active.  Click on Crystal Reports .NET SDK, Tutorials and Sample Code, CrystalReportViewer Object Model, Reading and Setting Discrete Parameters, and Setting Parameters Manually in Code for a good example of the correct way to do this - it looks like your missing some steps in your code.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: _charles
Date Posted: 22 Oct 2010 at 5:58am
hilfy,
 
Thank you for taking the time to answer! I set aside some time to work through the Visual Studio 2008/CR Tutorials at http://msdn.microsoft.com/en-us/library/ms227881%28v=VS.90%29.aspx - http://msdn.microsoft.com/en-us/library/ms227881(v=VS.90).aspx  even though none of them were specifically for SQL Server AND parameters I was able to figure it out using the ReportDocument Object Model and non-embedded reports and a completely differnt way of passing in parameters.
 
I believe you are correct in that I was missing some steps - Smile.
 
Thanks again.
 
Charles



Print Page | Close Window