Skip to Content
0
Former Member
Apr 25, 2007 at 06:45 PM

Can't pass date parameter to CR from PHP5?

812 Views

Post Author: halfer

CA Forum: Data Connectivity and SQL

FolksI am having real trouble passing a date parameter to the Crystal Reports 9 component from PHP5 on Windows. It should be easy, of course, but no:$rptParam = $rptParams->Item(2);$t = $rptParam->ValueType; // This comes out to 10, which is correct for a Crystal date type//None of these work//$rptParam->SetCurrentValue("25/04/2007");//$rptParam->SetCurrentValue("25-04-2007");//$rptParam->SetCurrentValue("25 April 2007");//$rptParam->SetCurrentValue("#25/04/2007#");//$rptParam->SetCurrentValue('20070425');//$rptParam->SetCurrentValue("25/04/2007 00:00");//$rptParam->SetCurrentValue("00:00 25/04/2007");//$rptParam->SetCurrentValue("00:00 25/04/2007");//$rptParam->SetCurrentValue("25/Apr/2007");//$rptParam->SetCurrentValue(date('c'));//$rptParam->SetCurrentValue(time());// These don't work either//$v = new Variant(time(), VT_DATE);$v = variant_date_from_timestamp(time());$rptParam->SetCurrentValue($v);Any thoughts as to what I might be doing wrong? It results on every occasion in these errors:PHP Fatal error: Uncaught exception 'com_exception' with message 'Source: Unknown Description: Unknown' in C:\dev-misc\crystal.php:57Stack trace:#0 C:\dev-misc\crystal.php(57): variant->SetCurrentValue(Object(variant))#1 thrown in C:\dev-misc\crystal.php on line 57Fatal error: Uncaught exception 'com_exception' with message 'Source: UnknownDescription: Unknown' in C:\dev-misc\crystal.php:57Stack trace:#0 C:\dev-misc\crystal.php(57): variant->SetCurrentValue(Object(variant))#1 thrown in C:\dev-misc\crystal.php on line 57 Thanks.