日期:2014-05-18  浏览次数:20887 次

◆vs2010 winform 水晶报表 如何给未绑定字段UnboundString赋值◆
如题,谢谢

------解决方案--------------------
C# code
 ParameterFields parameterFields = LoadOrderInfo(orderInfo);
this.crystalReportViewer1.ParameterFieldInfo = parameterFields;

    private ParameterFields LoadOrderInfo(receiveShipmentOrder orderview)
        {
            ParameterFields orderInfo = new ParameterFields();
            if (orderview != null)
            {
                orderInfo.Add(GetParameterField("supplierName", orderview.supplier.name));
                orderInfo.Add(GetParameterField("name", orderview.createUser.name));
                string state="";
                orderInfo.Add(GetParameterField("state", state));
                orderInfo.Add(GetParameterField("receiveCode", orderview.code));
            }
            return orderInfo;
        }
        //设置参数字段
        private ParameterField GetParameterField(string name, string value)
        {
            ParameterField field = new ParameterField();
            ParameterDiscreteValue fieldValue = new ParameterDiscreteValue();
            field.ParameterFieldName = name;
            fieldValue.Value = value;
            field.CurrentValues.Add(fieldValue);
            return field;
        }