当前位置:编程学习 > C#/ASP.NET >>

rdlc多值参数如何赋值?

    我做了个rdlc的报表,自己定义了一个报表参数选成多值,如何通过写程序代码给这个多值报表参数赋值呢? --------------------编程问答-------------------- 有做过的吗 --------------------编程问答-------------------- --------------------编程问答-------------------- 参考 --------------------编程问答-------------------- 根据用户所选的参数,把数据值传到SQL语句中即可.下面是RequestReport方法的源码

DataTable RequestReport(DateTime dtFrom, DateTime dtTo, string pMaterial, string pDept, string pRequester, string pIPRStatus) {

string MySQL = Purchase;

string whDate = " RequestDate BETWEEN '{0}' AND '{1}' ";

MySQL = MySQL + string.Format(whDate, dtFrom, dtTo);

string whMaterial = " AND MaterialCode='{0}' ";

if (pMaterial != "ALL")

{

MySQL = MySQL + string.Format(whMaterial, pMaterial);

}

string whDept = " AND RequestDepartment='{0}' ";

MySQL = MySQL + string.Format(whDept, pDept);

string whRequester=" AND Requester='{0}' ";

if(pRequester!="ALL")

MySQL = MySQL + string.Format(whRequester, pRequester);

string whIPRStatus = " AND IPRStatus={0} ";

if (pIPRStatus != "ALL")

{

MySQL = MySQL + string.Format(whIPRStatus, pIPRStatus);

}

IDataProvider privider = DataProvider.CreateDataProvider();

DataSet ds = privider.RetriveDataSet(MySQL);

if (ds != null && ds.Tables.Count > 0)

return ds.Tables[0];

else

return null;

}

const string Purchase="SELECT SerialNO,LedgerAcc,CostCenter,Requester,"+

" RequestDate,RequestDepartment,MaterialCode, " +

" Brand,Specifications,Unit,Quantity,Usage, "+

" ExpectedDeliveryDate,Currency "+

" ,Quotation1Supplier,Quotation1UnitPrice,Quotation1Amount, "+

" Quotation2Supplier,Quotation2UnitPrice,Quotation2Amount, "+

" Quotation3Supplier, Quotation3UnitPrice, Quotation3Amount, "+

" ProposedQuotationSupplier, ProposedQuotationUnitPrice, "+

" ProposedQuotationAmount,QuotationRemarks ,IPRStatus,QtyTo, UnitPriceTo FROM IPR WHERE "; --------------------编程问答-------------------- 我问的是,rdlc报表中自定义报表参数,把参数的多值属性选中以后,这个多值的参数如何通过asp.net页面传值
--------------------编程问答--------------------     
        
参数定义如上图
后台代码:
            List<ReportParameter> parameters = new List<ReportParameter>(ReportViewer1.LocalReport.GetParameters().Count);
            parameters.Add(new ReportParameter("报表中定义的参数名称", new string[]{"参数值1","参数值2"}));
            ReportViewer1.LocalReport.SetParameters(parameters);
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,