October 23, 2007 at 1:23 am
mrpolecat (10/22/2007)
I don't know about CR but I would suggest starting a new thread for the question so people who do can answer it. You may also want to post it under a topic like programming or reporting so you get the right people looking at it.
I have a few stored procedures as datasources for some of my Crystal Reports. All of them have parameters which I pass from VB6 to CR. I am having trouble passing date parameters as the usual format is not accepted by the sproc.
Any tips / leads?
October 23, 2007 at 1:31 am
Why not use the and and only unambigous, language and datesetting independent format we have?
'SSYYMMDD'
..should work with any SQL Server anywhere in the world.
/Kenneth
October 23, 2007 at 1:34 am
try this link with the samples.
http://www.vbmysql.com/articles/vb6-mysql/using-mysql-visual-basic-6-and-crystal-reports-9/
October 23, 2007 at 2:35 am
Kenneth Wilhelmsson (10/23/2007)
Why not use the and and only unambigous, language and datesetting independent format we have?'SSYYMMDD'
..should work with any SQL Server anywhere in the world.
/Kenneth
I tried all possible date formats via the ParameterFields(0) property in VB, the report just won't recognise any one of them.
I've temporarily bypassed the problem by passing the parameters as strings and converting them to dates in my sproc.
Any help will still be welcome.
October 23, 2007 at 3:08 am
VAIYDEYANATHAN.V.S (10/23/2007)
Thanks, I took a look at it; it is good but not of immediate use for me for this issue.
October 24, 2007 at 10:52 am
try something like....
Dim crptApp As CRAXDRT.Application
Dim crptParmDefs As CRAXDRT.ParameterFieldDefinitions
Dim crptParmDef As CRAXDRT.ParameterFieldDefinition
For Each crptParmDef In crptParmDefs
With crptParmDef
IF .ParameterFieldName = "ReportDateParameterName" then
.SetCurrentValue dtDateVariable
End If
End With
Next
October 24, 2007 at 11:04 am
This has worked for me. I use VB.Net but should not make a difference for VB 6.0
Private Sub SetCrystalParameterDate(ByRef crParamFieldDefs As ParameterFieldDefinitions, _
ByVal ParamName As String, ByVal ParamValue As DateTime)
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As ParameterValues
Dim crParameterDiscreteValue As ParameterDiscreteValue
crParameterFieldDefinition = crParamFieldDefs.Item(ParamName)
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Clear()
crParameterDiscreteValue = New ParameterDiscreteValue
crParameterDiscreteValue.Value = ParamValue
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
End Sub
''Then call the Proc.
SetCrystalParameterDate(crParameterFieldDefinitions, "CrystalParameterName", dteToPassToReport)
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply