在crystalReport(水晶报表)动态输入参数(转)

作者:袖梨 2022-07-02
命名空间为:using CrystalDecisions.Shared        
private void BuildReportViewerParameters(CrystalDecisions.Web.CrystalReportViewer rptViewer, Hashtable ParamTable)
        {
       //定义报表视图的参数的方法
       ParameterFields ParamFields = new ParameterFields();
       foreach (object key in ParamTable.Keys)
       {
           ParameterField ParamField = new ParameterField();
           ParameterValues ParamValues = new ParameterValues();
           ParameterDiscreteValue ParamValue = new ParameterDiscreteValue();
           ParamValue.Value = ParamTable[key].ToString();
           ParamValues.Add(ParamValue);
           ParamField.ParameterFieldName = key.ToString();
           ParamField.CurrentValues = ParamValues;
           ParamFields.Add(ParamField);
       }
       rptViewer.ParameterFieldInfo = ParamFields;

相关文章

精彩推荐