473,410 Members | 1,930 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,410 software developers and data experts.

How to pass a date parameter in Crystal reports

Hi,

I am using a dataset for my Crystal report. Query: Select * from Orders where Date = @Date

How do I pass that to my Crystal Report. This will be passed with a calander I have on my form with a button to display data.

Thanks for the help.
Apr 2 '07 #1
4 10417
dip_developer
648 Expert 512MB
Hi,

I am using a dataset for my Crystal report. Query: Select * from Orders where Date = @Date

How do I pass that to my Crystal Report. This will be passed with a calander I have on my form with a button to display data.

Thanks for the help.
Do u want to Pass Date value as a parameter to the Crystal report.....

Create a Parameter Fields in your report .Name it as Order_Date,set its Value Type to Date.......By right Clicking on "Parameter Fields"-----> "New" option.....

In code behind to set the parameter value the code will be like following.....


Expand|Select|Wrap|Line Numbers
  1. Dim oRpt as Myreport
  2. oRpt.SetParameterValue("Order_Date", myDate)
Apr 2 '07 #2
Thanks dip_developer

I had to get some sleep. Will be trying that now and will let you know what happens.

Lawrence
Apr 2 '07 #3
dip_developer,

It still runs the report and display's all the data. Not just the data for the day I need.

Any Ideas?
Apr 2 '07 #4
To all that wants to know, here is the answer.

After a lot of searching this is what I did to make it work:


rpt = New CrystalReport1()
Dim reportPath As String = "C:\Crystalreport1.rpt"
CView.ReportSource = rpt
Dim field1 As ParameterField = Me.CView.ParameterFieldInfo(0)
Dim val1 As ParameterDiscreteValue = New ParameterDiscreteValue
val1.Value = "2/20/2007"
field1.CurrentValues.Add(val1)
rpt.Load(reportPath)

It is VERY important to place the parameter After :

CView.ReportSource = rpt
And before:
rpt.Load(reportPath)

It will not work if you don't do this.

Lawrence
Apr 3 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Wayne Baswell | last post by:
I want to pass a date variable to a sql statement from Crystal Reports. The part of the query accepting the variables looks like: "Calendar_Date between To_Date('1-JUN-03','mm/dd/yy') and...
0
by: Raj | last post by:
hi, How to pass a Two Date parameter to a report at runtime using VB .NET 1. How do we pass multiple values eg. Startdate, EndDate to crystal reports parameter. 2. I have a report to...
0
by: John Smith | last post by:
I'm passing two date parameters into a crystal report but it won't let me input anythign other than mm/dd/yy. What I want to put in is dd/mm/yy. Here is my code: Dim cr As New cleaningHistory ...
4
by: MeNotHome | last post by:
I have a couple of variables in vb.net that I want to have printed on my crystal reports report. How can I do this? Thanks for any info
4
by: Marcelo | last post by:
Any suggestion? Thanks Marcelo
5
by: rammy | last post by:
I have a stored procedure that gets the date as input parameter. I have connected this stored proc to crystal report. When i run the report, for the date parameter, the crystal report is asking to...
1
by: sreedivya | last post by:
Hi All I am trying to create crystal reports. In this concern i have created a command which execute a stored procedure. This stored procedure takes three parameters which in turn i want to pass it...
1
by: kizmar | last post by:
I'm having an issue with a stored procedure I'm working on. One of the parameters is a DATE field. I'm attaching to this stored procedure with Crystal Reports, which is passing something like...
0
by: jans78 | last post by:
Appreciate if you all can help me to solve my Crystal Report problems First, I create some parameters and one of the parameters is Date. I set the parameter for the date is String. For example :...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.