Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:22 PM.


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