一聚教程网:一个值得你收藏的教程网站

热门教程

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

时间:2022-07-02 11:30:45 编辑:袖梨 来源:一聚教程网

命名空间为: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;

热门栏目