Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Crystal Reports for VS.NET
This is the forum to discuss the Wrox book Professional Crystal Reports for Visual Studio .NET by David McAmis; ISBN: 9780764544033
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Crystal Reports for VS.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 13th, 2006, 08:52 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Contents of report are blank

I have written a v8.5 Crystal Report for use with the Informix 3.82 database that I am using, and have placed the single parameter that the report requires as a text item in the header of the report.

I can run the CR from Windows Explorer, and after entering the parameter's value on the "Enter Parameter Values" page, the CR will come up with all of the correct data. Yea.

I need to programmatically run this report and pass the parameter in through a VB.NET program. So I wrote a VB.NET program that passes the value to the CR and loads it into a Crystal Report Viewer.

The report is displayed in the CR Viewer window, and the parameter that I have passed is displayed in the header of the report, so I know that my parameter has been passed successfully, but aside from the field descriptions, the report is blank, i.e. the titles are there but there is no data displayed.

It is almost like there is something missing from my environment when the report is run via VB. Could it be something to do with Informix? Does anyone have an idea of what might be causing this issue?

Must I somehow bind the database to the report or the report to the program?

Thanks

CODE:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   Dim MyReport As New CRTest
   CrystalReportViewer1.ReportSource = MyReport

   ' The parameter is passed to the report, as is witnessed by its
   ' value being placed on the header of the report, but no data is
   ' printed on the report

   ' Either of the following two lines can be used with the same results:
   ' (1)
   ' SetParameterDiscreteWithViewer(CrystalReportViewer 1, "Rack", "402074", "")
   '
   ' (2)
   SetParameterDiscreteWithReport(MyReport, "Rack", "402074", "")

End Sub

Public Sub SetParameterDiscreteWithReport(ByVal MyReport As CrystalDecisions.CrystalReports.Engine.ReportDocum ent, ByVal ParameterName As String, ByVal Value As Object, ByVal SubreportName As String)

   Dim MyParameterFieldDefinition As CrystalDecisions.CrystalReports.Engine.ParameterFi eldDefinition
   Dim MyParameterValues As CrystalDecisions.Shared.ParameterValues
   Dim MyParameterDiscreteValue As CrystalDecisions.Shared.ParameterDiscreteValue

   MyParameterFieldDefinition = MyReport.DataDefinition.ParameterFields.Item("Rack ", "")
   MyParameterValues = New CrystalDecisions.Shared.ParameterValues
   MyParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
   MyParameterDiscreteValue.Value = Value
   MyParameterValues.Add(MyParameterDiscreteValue)
   MyParameterFieldDefinition.ApplyCurrentValues(MyPa rameterValues)
End Sub

Public Sub SetParameterDiscreteWithViewer(ByVal CrystalReportViewer1 As CrystalDecisions.Windows.Forms.CrystalReportViewer , ByVal ParameterName As String, ByVal ParameterValue As Object, ByVal SubreportName As String)
   Dim MyParameterFields As CrystalDecisions.Shared.ParameterFields
   Dim MyParameterField As CrystalDecisions.Shared.ParameterField
   Dim MyParameterDiscreteValue As CrystalDecisions.Shared.ParameterDiscreteValue
   MyParameterFields = CrystalReportViewer1.ParameterFieldInfo
   MyParameterField = MyParameterFields(ParameterName, SubreportName)
   MyParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
   MyParameterDiscreteValue.Value = ParameterValue
   MyParameterField.CurrentValues.Add(MyParameterDisc reteValue)
   CrystalReportViewer1.ParameterFieldInfo = MyParameterFields
End Sub
 
Old April 26th, 2006, 04:47 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The piece I was missing was Crystal Reports Developer - I just had a full version of CR11.




Similar Threads
Thread Thread Starter Forum Replies Last Post
missing contents parry JSP Basics 1 August 25th, 2008 03:03 PM
Parameters fields coming up blank in report jjshah BOOK: Professional Crystal Reports for VS.NET 0 January 26th, 2005 03:19 PM
User can not view Report Manager contents lidsurfer BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 November 23rd, 2004 01:33 PM
set data source to blank report lpastor Crystal Reports 0 October 15th, 2004 05:21 AM
Blank Report BSkelding Crystal Reports 3 June 16th, 2004 04:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.