473,795 Members | 2,834 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to pass a date parameter in Crystal reports

41 New Member
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 10451
dip_developer
648 Recognized Expert Contributor
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
Lawrence 007
41 New Member
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
Lawrence 007
41 New Member
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
Lawrence 007
41 New Member
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:\Crystalrepo rt1.rpt"
CView.ReportSou rce = rpt
Dim field1 As ParameterField = Me.CView.Parame terFieldInfo(0)
Dim val1 As ParameterDiscre teValue = New ParameterDiscre teValue
val1.Value = "2/20/2007"
field1.CurrentV alues.Add(val1)
rpt.Load(report Path)

It is VERY important to place the parameter After :

CView.ReportSou rce = rpt
And before:
rpt.Load(report Path)

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
9644
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 To_Date('30-JUN-03','mm/dd/yy')" And I'd be wanting to replace the date part of the query with a user-entered date. As I'm new to Oracle and Crystal, I don't know where to start. Is there a way to replace the '1-JUN-03' part with a variable in...
0
1674
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 filter by two dates like FromDate And ToDate
0
1393
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 Dim objParameterFieldDefinition As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
4
3349
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
2261
by: Marcelo | last post by:
Any suggestion? Thanks Marcelo
5
11945
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 select time also. But i don't want to choose time, I only need the date component. Is there any way i can supress/remove the time field in crystal.
1
1976
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 from .aspx page. when i click on button parameters should pass to that stored procedure. for example exec sp_example @date='{?selecteddate}' here date (varchar in stored procedure) and selected date (string type i selected) whenever i am...
1
1788
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 "2007-12-20" to the stored procedure. When I try to use this variable (parameter) in a dynamic SQL statement, it keeps converting it to "2007 minus 12 minus 20" or "1975". I haven't been able to find away around this. I want to filter records based on...
0
3692
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 : parameter 1 - From Collection Date parameter 2 - To Collection Date I should display the results base on this selection criteria : 1) specific date - to enter specific date in FROM and TO field eg 20071227 to 20071227 2) greater or equal date -...
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9522
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10165
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10002
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9044
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6783
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.