当前位置:编程学习 > 网站相关 >>

水晶报表(推模式)(学习笔记)

vs2008中:

 

 

 

protected void Page_Load(object sender, EventArgs e)

        {


            //推模式
            CrystalReport1 rpt = new CrystalReport1();
            rpt.SetDataSource(CommonCode.GetData());


           
            CrystalReportViewer1.ReportSource = rpt;

        }

 

 

 

 


 public static class CommonCode
    {
        public static DataTable GetData()
        {
            string constr = "Data Source=.;Initial Catalog=db_Test;Integrated Security=True";
            using (SqlConnection conn = new SqlConnection(constr))
            {
                SqlDataAdapter da = new SqlDataAdapter("select * from dbo.T_Orders",conn);
                DataSet ds = new DataSet();
                da.Fill(ds);
                return ds.Tables[0];
            }


        }
    }


 

补充:综合编程 , 其他综合 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,