//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();
            }

相关文章:

  • 2021-07-06
  • 2022-12-23
  • 2021-12-04
  • 2021-05-18
  • 2021-06-20
  • 2021-09-30
  • 2022-12-23
猜你喜欢
  • 2021-11-13
  • 2021-05-23
  • 2021-07-19
  • 2021-10-23
  • 2022-01-14
  • 2021-06-30
相关资源
相似解决方案