asp.net2005中的web项目使用reportviewer控件连接rdlc报表,而数据集xsd是使用创建向导建立的,里面的select  sql语句是这样:  
select  *  from  ddmb  where  dw=@dw  and  year_month=@year_month  
可是这两个参数怎么传进来阿?还有怎么动态添加数据集,就是不使用创建向导建立,用代码建立?

解决方案 »

  1.   

    我是用objectdatasource来传参数的
    ReportViewer1.ProcessingMode = ProcessingMode.Local;
    ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/ContractQuery.rdlc");
    ObjectDataSource ods = new ObjectDataSource("MDCLib", "QueryContract");
    QueryStringParameter para = new QueryStringParameter("QueType", TypeCode.String,"reportid");
    para.DefaultValue = "0";
    ods.SelectParameters.Add(para);
    ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("mdc_ExpireContract_MDC_ExpireContract", ods));
      

  2.   

    ReportViewer1.ProcessingMode = ProcessingMode.Local;
    ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/ContractQuery.rdlc");
    ObjectDataSource ods = new ObjectDataSource("MDCLib", "QueryContract");
    QueryStringParameter para = new QueryStringParameter("QueType", TypeCode.String,"reportid");
    para.DefaultValue = "0";
    ods.SelectParameters.Add(para);
    ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("mdc_ExpireContract_MDC_ExpireContract", ods));