473,408 Members | 1,700 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,408 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 1761
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...
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
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.