代码尽量全面,必须是动态的,

解决方案 »

  1.   

    你到网找找吧
    rdlc google
    挺多的
      

  2.   


    下面是核心代码,你分析一下,一定可以的,因为里面还要建立dataset集,代码很难贴全,但你认真分析下面的就一定可以,当初我为了下面的代码搞了一个星期,(网上面的代码拖泥带水,不简洁,)终于在VS2005测试通过,using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using Microsoft.Reporting.WinForms;
    namespace rdlc
    {
       
        public partial class Form1 : Form
        {
            ReportDataSource reportdatasource1 = new ReportDataSource();
            ReportDataSource reportdatasource2 = new ReportDataSource();
            DataSet mydataset = new DataSet();
            DataSet mydataset2 = new DataSet();
            public Form1()
            {
                InitializeComponent();
                bind();
                this.reportViewer1.RefreshReport();
            }        private void Form1_Load(object sender, EventArgs e)
            {            
            }        public void bind()        {
                data mydata = new data();
                string str = "select * from mysfc2 where 存货编码='ww001'";
                mydataset = mydata.getlist(str,"mysfc2");
                reportdatasource1.Name = "caigouDataSet_mysfc2";
                reportdatasource1.Value = mydataset.Tables[0];
                this.reportViewer1.LocalReport.DataSources.Add(reportdatasource1);
                this.reportViewer1.LocalReport.DataSources.Add(reportdatasource2);
                this.reportViewer1.LocalReport.ReportEmbeddedResource = "rdlc.Report1.rdlc";
            }        private void reportViewer1_Load(object sender, EventArgs e)
            {        }    }
        
    }
      

  3.   

    //rpvStuent.LocalReport.ReportEmbeddedResource = "WinAppActReport111.Report1.rdlc";
                ////设计新报表和报表控件的连接            ////studentBindingSource.Add(dt);
                //rpvStuent.LocalReport.ReportPath = "Report1.rdlc";
                //ReportDataSource rds = new ReportDataSource();
                //rds.Name = "DataSet_student";
                //rds.Value = dt;
                //rpvStuent.LocalReport.DataSources.Add(rds);            ////this.rpvStuent.RefreshReport();            //rpvStuent.RefreshReport();