| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 676 人关注过本帖
标题:rdlc报表问题
只看楼主 加入收藏
plm010
Rank: 2
等 级:论坛游民
帖 子:38
专家分:20
注 册:2007-7-11
结帖率:83.33%
收藏
已结贴  问题点数:18 回复次数:6 
rdlc报表问题
private void label1_Click(object sender, EventArgs e)
        {
            //MessageBox.Show("label1");
            this.label1.Cursor = Cursors.Hand;
            Form4 fr4 = new Form4();
            if (fr4.ShowDialog() == DialogResult.Cancel)
            {
                string xm = fr4.InputValue;

                DBCon db = new DBCon();
                OleDbConnection conn = db.CreateCon();

                string strSql = "select * from Revenue where InComeName='" + xm + "'";
                OleDbCommand cmd = new OleDbCommand(strSql, conn);
                OleDbDataAdapter oda = new OleDbDataAdapter(cmd);
                DataSet accountsDataSet_Revenue = new DataSet();
                try
                {
                    conn.Open();
                    oda.Fill(accountsDataSet_Revenue);
                }
                finally
                {
                    conn.Close();
                    // cmd.Dispose();
                    //conn.Dispose();
                }
                //为报表浏览器指定报表文件
                string path = @"D:\\rdlc_report\\rdlcrpt3\\rpt\\rpt\\Rev_Report.rdlc";
                reportViewer1.LocalReport.ReportPath = path;
                //指定数据集,数据集名称后为表,不是DataSet类型的数据集
                this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("accountsDataSet", accountsDataSet_Revenue.Tables[0]));
                //显示报表
                this.reportViewer1.RefreshReport();
            }
        }

        private void label3_Click(object sender, EventArgs e)
        {
            Form4 fr4 = new Form4();
            if (fr4.ShowDialog() == DialogResult.Cancel)
            {
                string xm = fr4.InputValue;
                DBCon db = new DBCon();
                OleDbConnection conn = db.CreateCon();
                string strSql = "select * from Expendtl where ExOutNo='" + xm + "'";
                OleDbCommand cmd = new OleDbCommand(strSql, conn);
                OleDbDataAdapter oda = new OleDbDataAdapter(cmd);
                DataSet Expen_ds = new DataSet();
                try
                {
                    conn.Open();
                    oda.Fill(Expen_ds);
                }
                finally
                {
                    conn.Close();
                    //cmd.Dispose();
                    //conn.Dispose();
                }
                //为报表浏览器指定报表文件
                string path = @"D:\\rdlc_report\\rdlcrpt3\\rpt\\rpt\\Expen_Report.rdlc";
                reportViewer1.LocalReport.ReportPath = path;
                //指定数据集,数据集名称后为表,不是DataSet类型的数据集
                this.reportViewer1.LocalReport.DataSources.Clear();
                this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("Expen_ds", Expen_ds.Tables[0]));
                //显示报表
                this.reportViewer1.RefreshReport();
            }

问:如果我先点label1报表显示正常,接着点label3报数据源错误,数据源为什么还是label1的数据源呢?
    如果我先点label3报表显示也正常,接着点label1报数据源错误,数据源为什么还是label3的数据源呢?

分有点少,忘那位好心的大哥帮帮我嘛!
搜索更多相关主题的帖子: rdlc 
2010-06-01 09:56
plm010
Rank: 2
等 级:论坛游民
帖 子:38
专家分:20
注 册:2007-7-11
收藏
得分:0 
自己顶起来哦
2010-06-01 11:45
plm010
Rank: 2
等 级:论坛游民
帖 子:38
专家分:20
注 册:2007-7-11
收藏
得分:0 
自己顶
2010-06-01 13:46
plm010
Rank: 2
等 级:论坛游民
帖 子:38
专家分:20
注 册:2007-7-11
收藏
得分:0 
怎么没有好心人嘛!
2010-06-02 15:55
ghl2312
Rank: 4
等 级:业余侠客
威 望:2
帖 子:208
专家分:226
注 册:2008-7-10
收藏
得分:10 
绑定,代码看起来没问题么。

向灰太狼学习
2010-06-03 16:12
ghl2312
Rank: 4
等 级:业余侠客
威 望:2
帖 子:208
专家分:226
注 册:2008-7-10
收藏
得分:8 
绑定,代码看起来没问题么。

向灰太狼学习
2010-06-03 16:12
plm010
Rank: 2
等 级:论坛游民
帖 子:38
专家分:20
注 册:2007-7-11
收藏
得分:0 
感谢各位回答!
问题搞定了!
结贴了!!
2010-06-05 22:14
快速回复:rdlc报表问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015382 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved