473,385 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Crystal Report .NET - Passing a Parameter at run-time

I have a simple Crystal Report developed within .NET. Currently, it displays
all fields from a view. Could someone please tell me how I could pass a
parameter to the report to only display the record(s) affected? i.e. only
display information where the VisitID = 1 (for example). I can set it up to
be hard-coded to be VisitID = 1, but need to be able to do this dynamically
at run-time from within my .NET application... I would appreciate any help!

Thanks,
-Valerie
Jul 22 '05 #1
1 1759
Use the following vb code:

Imports:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Code:

Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues()
Dim crParameterDiscreteValue As New ParameterDiscreteValue()

' 1st Parameter
crParameterDiscreteValue.Value = VisitID
crParameterFieldDefinitions =
crReportDocument.DataDefinition.ParameterFields
crParameterFieldDefinition =
crParameterFieldDefinitions.Item("prmVisitID")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crPa rameterValues)

In your crystal report, create a param field called prmVisitID. Drag the
VisitID on the form and right-click, choose Select Expert and make it equal
to the prmVisitID.
"kvrdev1" wrote:
I have a simple Crystal Report developed within .NET. Currently, it displays
all fields from a view. Could someone please tell me how I could pass a
parameter to the report to only display the record(s) affected? i.e. only
display information where the VisitID = 1 (for example). I can set it up to
be hard-coded to be VisitID = 1, but need to be able to do this dynamically
at run-time from within my .NET application... I would appreciate any help!

Thanks,
-Valerie

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Oldhandandy | last post by:
Since upgrading to .Net 2003, when I run report reports within an application using CrystalReportViewer, I'm getting the error "Specified Cast is not Valid". A value is being passed into the report.
1
by: Maria | last post by:
Hello! I am new to Crystal reports an I have problems passing parameters form outside to Crystal report an creating a report with data from more than one table This is the problem: I have to...
0
by: mmccor | last post by:
Hi. I'm having a problem passing a value to a sql stored procedure parameter in a crystal report. When I run a trace on Sql Server the parameters are empty or null. The procedure contains one...
0
by: murlbrown | last post by:
I have built a report using Crystal Report 8.0, which is set to get its data from a MS SQL Stored Procedure with 1 Parameter(smalldatetime). I can get the report to display in crystal with data,...
1
by: raf_z | last post by:
Hi, I'm running a website with Asp.NET, and on one of the pages i have a crystal report with 3 user-populated parameters. However, not all params might be selected. Example: Parameters: 1....
0
by: william_dudek | last post by:
I have a crystal report that works fine when run through Crystal, which I am triying to incorporate into a crystal report viewer. The report takes 1 parameter, which is either 0 or 1. If the...
0
by: John F | last post by:
Hi, If there is a more appropriate group for this, please point me in the right direction. I have a Crystal Report .rpt file that I can get to launch from my code and I can view it. I pass...
1
by: JC - home | last post by:
This is driving me mad!! I have a report viewer on a form that is bound to a sql stored procedure that has one parameter. I just can't seem to find a way of passing a parameter to the report...
0
by: zellipa | last post by:
I am trying to imbed crystal in oracle. I got the following steps from the web. when i try to run the created from , iget the error frm-41344. Any suggestions. Regards, Zellipa STEPS TO...
1
by: imtmub | last post by:
Hi All, I have mainpage (POselect.aspx). language VB In that page i have a textbox (txtPOId) and command button(Button1) When i press then button its should send the textbox value to Crystal...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.