OK, this should be simple. In my .dplx file I have a VERY SIMPLE query :
select * from DeviceData
where SerialNumber = #Parameters["SerialNumber"]#
and CreatedAt >= #Parameters["StartDate"]#
and CreatedAt <= #Parameters["EndDate"]#
and in my C# I have this:
var reportDoc =
new DocumentLayout(
@"C:\Temp\Standard_Report.dplx");
SqlQuery query = (SqlQuery)reportDoc.GetElementById("Query1");
query.ConnectionString = System.Security.SecurityElement.Escape(connectionString);
query = (SqlQuery)reportDoc.GetElementById("Query2");
query.ConnectionString = System.Security.SecurityElement.Escape(connectionString);
var reportParms = new ParameterDictionary();
reportParms.Add("RequestedBy", "Russell de Pina");
reportParms.Add("RequestDate", DateTime.Now.ToString("yyyy-MMM-dd"));
reportParms.Add("SerialNumber", "100000002");
reportParms.Add("StartDate", startDate);
reportParms.Add("EndDate", endDate);
var doc = reportDoc.Run(reportParms);
doc.Draw(@"C:\Temp\reportTest.pdf");
At this point, I'll not touch on the bullsh*t related to getting the connection string to work. But what is really got me ticked is the SQL error saying that I have to declare the scalar variable @SerialNumber, which is definitely defined in the ParameterDictionary for the report.
Why is the parameter value substution not happening?
Not a happy customer