Hello,
I am using VB .Net 2003 with Crystal Reports 8.5 and SQL Server 2000. I am trying to pass a datetime parameter to my report. The report seems to ignore the datatime parameter but no other parameter.
Any help would be appreciated.
Thanks
Rachael
Right now to test i'm just hardcoding the value in. Eventually I would like it to be either a dropdown list box or a datetime picker which would then be a variable of some sort.
The code i am using is:
Dim crReport As New ProductionReport2
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As ParameterValues
Dim crParameterStartDate As New ParameterDiscreteValue
Dim crParameterEndDate As New ParameterDiscreteValue
Dim crParameterPartNum As New ParameterDiscreteValue
'START DATE
crParameterStartDate.Value = CDate("4/1/2004 12:00:00 AM")
I can see what you are trying to do but do not know where the problem lies. I do have a suggestion though for something that you could try that should work.
Here is how I am passing in values to CR.
With in CR I use the formula generator to create a formula that has "" as its only code.
I then set up a global variable that can be read in the CRForm. Then within the CRForm the following code pulls that value of the global into the report.
'varaible to create the report document
Dim oDoc As ReportDocument
'transfer value of global to report
oDoc.DataDefinition.FormulaFields.Item("UserName").Text = "'" & userName & "'"
'view the report
CrystalReportViewer1.ReportSource = oDoc
Thank You very much for the reply. That might work for two of my parameters that are the datatime values. I do have another parameter that is string that can accept more than one value. Not sure if this will work for that one. Can I pass that parameter the other way and use your suggestion for the two dates? Not quite sure if that would work.
I do not think there should be any problem even with your string variable. I have one item set up this way that passes through a long string ( up to 24 dates ). I think that as long as you are able to set it into a global variable it should work fine.
There have been a few issues with Crystal Reports and .Net. I've learned much from their site:
support.crystaldecisions.com
One such issue had something to do with the fact that if you created a report and initially had the "save data with report" option checked, and unchecked it later, then it wouldn't care. It recommended to resave the report under a new filename.
There are also many patches available for Crystal Reports which fix several issues. Give the website a try, and look at the patches, see if they can fix what you need. Beware though, some of the patches say something to the effect don't install until you read what they will do. I have never had a problem, however.
Thank You for all of the replys. I did get it to work using the method I was originally trying to use sometime ago. I have also read about some issues with CR and .NET, but none of the fixes seemed to be what I was looking for.
Anyway, it works now.
Thanks again.
Rachael
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.