Skip to Content
0
Former Member
Apr 14, 2010 at 05:48 PM

How to pass a datetime to ReportParameterSingleValue in VB.NET?

53 Views

Hi,

I'm struggling to understand how to pass a datetime to ReportParameterSingleValue in VB.NET

When viewing the report using the Crystal Reports Viewer in the Central Management Console, it prompts "Please enter DateTime in format "dd/mm/yyyy hh:mm:ss"".

Here's a snippet of my code:

Dim myReportParameters As ReportParameters = myreport.ReportParameters

        For Each param As ReportParameter In myReportParameters

            param.CurrentValues.Clear()
            Dim myReportParameterSingleValue As ReportParameterSingleValue = param.CreateSingleValue()

            Select Case param.ParameterName
                Case "PD_PERIODENDDATE_IN"
                    myReportParameterSingleValue.Value = "31/12/2009 00:00:00"
                Case "PD_TRADINGPARTYID"
                    myReportParameterSingleValue.Value = "BPGAS"
            End Select

            param.CurrentValues.Add(myReportParameterSingleValue)

        Next

When I run it, I get an invalid argument error. Do I need to format the date somehow?

Thanks a lot for any help!