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

  • 相关阅读:
    ExcelManager基于.Net的Excel读写管理类库(二)
    ExcelManager基于.Net的Excel读写管理类库(一)
    NHibernate初探!
    也谈软件工程!
    本人初学WCF ,请教一个问题
    初来咋到,今天终于在这里建起了一个家!
    c#中委托和直接函数调用用什么区别,好处和目的在哪?
    CreateThread, AfxBeginThread,_beginthread, _beginthreadex的区别
    C++线程同步
    C++中using的作用
  • 原文地址:https://www.cnblogs.com/kingwangzhen/p/1497222.html
Copyright © 2011-2022 走看看