asp.net中使用水晶报表 ---pull

创建这个的过程和使用向导的一样

然后编写后台代码

        private void Show()
        {
            pd = new ReportDocument();
            pd.Load(Server.MapPath("~/Report/scend_report.rpt"));
            ConnectionInfo cinFo = new ConnectionInfo();
            cinFo.UserID = "sa";
            cinFo.Password = "12345";
            cinFo.DatabaseName = "Demo";
            Tables tbles = pd.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table tb in tbles)
            {
                TableLogOnInfo ton = tb.LogOnInfo;
                ton.ConnectionInfo = cinFo;
                tb.ApplyLogOnInfo(ton);
            }
            CrystalReportViewer1.ReportSource = pd;
        }

然后就可以在浏览器中查看了

 

posted @ 2017-02-07 20:23  夏风微凉  阅读(317)  评论(0编辑  收藏  举报