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;
        }

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

Hold on, everything is possible.
原文地址:https://www.cnblogs.com/student-note/p/6375817.html