C# 如何向Stimulsoft发送参数?
我在designer中有存储过程和执行,但我不向它发送参数,也不在何时发送 运行应用程序时,我收到以下错误: 错误:SqlCommand.Prepare方法要求所有可变长度参数的大小均显式设置为非零C# 如何向Stimulsoft发送参数?,c#,asp.net-mvc,stimulsoft,C#,Asp.net Mvc,Stimulsoft,我在designer中有存储过程和执行,但我不向它发送参数,也不在何时发送 运行应用程序时,我收到以下错误: 错误:SqlCommand.Prepare方法要求所有可变长度参数的大小均显式设置为非零 我该怎么办?在编译报告之前,您可以使用以下代码: public virtual ActionResult GetReportSnapshot() { var data = (ComparativeBalanceReportDS) TempData["Comparativ
我该怎么办?在编译报告之前,您可以使用以下代码:
public virtual ActionResult GetReportSnapshot()
{
var data = (ComparativeBalanceReportDS) TempData["ComparativeSession"];
StiReport report = new StiReport();
report.Load(Server.MapPath("~/Content/StimulReports/SampleReport.mrt"));
report.Compile();
report["fromDocumentNumber"] = "1";
report["toDocumentNumber"] = "85";
return StiMvcViewer.GetReportSnapshotResult(HttpContext, report);
}
还可以在参数表达式中使用其他变量。在这种情况下,您应该在呈现报告之前设置变量的值。我的问题已通过以下代码解决:
report.Dictionary.DataSources["DataSourceName"].Parameters["ParameterName"].Value = ""
public virtual ActionResult GetReportSnapshot()
{
var data = (ComparativeBalanceReportDS) TempData["ComparativeSession"];
StiReport report = new StiReport();
report.Dictionary.DataStore.Clear();
report.Load(Server.MapPath("~/Content/StimulReports/SampleReport.mrt"));
report["@enterpriseId"] = data.EnterpriseId;
report["@toDocumentNumber"] = data.NumberFilter.FromDocumentDocumentNumber;
report["@fromDocumentNumber"] = data.NumberFilter.ToDocumentDocumentNumber;
report["@fromDate"] = data.DateFilter.FromDocumentDate.Value;
report["@toDate"] = data.DateFilter.ToDocumentDate.Value;
return StiMvcViewer.GetReportSnapshotResult(HttpContext, report);
}