Hello,
I am trying to pass a C# DateTime object programatically to a report where that datetime is used in a Crystal Reports selection clause. A snippet of the code is as follows:
I can't get cut and paste to work in this window so bear with me.
report.SetParameterValue(0, assetID);
report.SetParameterValue(1, mPassTerminationNotification.PassStartTime.ToString());
report.SetParameterValue(2, mPassTerminationNotificaiton.PassEndTime.ToString());
report.SetParameterValue(3, passID);
report.ExportToDisk(ExportFormatType.Excel, filename);
Crystal Reports get these parameters and does a where clause and the DateTime seem to be the issues.
{Asset.Asset_Name} = {?@assetID} and
{Pass.Pass_ID} = {?@passID} and
{Alert.Alert_DateTime} >= {?startTime} and //This line is the issue
{Alert.Alert_DateTime} <= {?endTime} and //This line is the issue
isnull({Alert.Measurand_Index})
When run it throws an exception Unable to connect: Incorrect log on parameters
Note rpt file goes to a Table query thorugh an ODBC connection.
Report runs fine when running through Crystal Reports 2011 directly.
PS. I tried removing the two lines above and it ran. I also tried sending the C# DateTimes without the ToString() and it resulted in the same error.
Any assistenace would be greatly appreciated. Also if you know a way to cut and paste into this forum that would be helpful as well.