zoukankan      html  css  js  c++  java
  • WebForm Report 一个Demo Code

    //declare conn string
                string connstr =
                    "Data Source=168.10.11.3;Initial Catalog=RealWorld;Persist Security Info=True;User ID=sa;Password=111111";

                //declare conn ,command
                SqlConnection conn = new SqlConnection(connstr);
                SqlCommand cmd = new SqlCommand();
                DataSet ds = new dsReport();
                try
                {
                    conn.Open();
                    cmd.Connection =conn;
                    cmd.CommandText = "SELECT * FROM AgedAR";
                    SqlDataReader dr = cmd.ExecuteReader();
                    ds.Tables[0].Load(dr);
                    //=============================================
                    //与winform不同
               //   ReportViewer1.LocalReport.ReportEmbeddedResource = "Report1.rdlc";
                    ReportViewer1.LocalReport.ReportPath = "Report1.rdlc";

                    //Report DataSource

                    ReportDataSource rds = new ReportDataSource();
                    rds.Name = "dsReport_dtAgedAR";
                    rds.Value = ds.Tables[0];
                    ReportViewer1.LocalReport.DataSources.Add(rds);

                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
                finally
                {
                    conn.Close();
                }

  • 相关阅读:
    人月神话读后感2
    人月神话读后感1
    自己跟自己聊天的软件2
    做一个自己跟自己聊天的软件
    安装Android开发工具
    阅读笔记6
    阅读笔记5
    第16周学习进度总结
    个人课程总结
    第15周学习进度总结
  • 原文地址:https://www.cnblogs.com/kingwangzhen/p/1497222.html
Copyright © 2011-2022 走看看