zoukankan      html  css  js  c++  java
  • CrystalReport第一步

    1、添加新项->Reporting->CrystalReport1.rpt

    2、CrystalReport1.rpt这里大家慢慢摸索

    3、建立一个webform1.spx页面,工具箱中拖入CrystalReportViewer到页面中

    4、webform1.aspx.cs

            protected void Page_Load(object sender, EventArgs e)
            {
                ReportDocument oRpt = new ReportDocument();
                string RptDir=Server.MapPath("CrystalReport1.rpt");
                oRpt.Load(RptDir);
                DataSet1 ds = new DataSet1();

                //获得数据
                SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["TestDBConnectionString"].ConnectionString);
                SqlCommand command = conn.CreateCommand();
                command.CommandType = CommandType.Text;
                command.CommandText = "SELECT * FROM Table1";
                SqlDataAdapter da = new SqlDataAdapter(command);
                da.Fill(ds.Table1);
                oRpt.SetDataSource(ds);
                CrystalReportViewer1.ReportSource = oRpt;
            }

    5、运行
  • 相关阅读:
    STL(五)list
    WinCE进程ID获取窗口句柄
    【转】.obj, .lib, .dll, .exe的关系
    《Windows核心编程》——线程
    【转】windows结束线程方式
    VS2005调试多进程
    【转】VC中常用的宏
    【转】C++标准库简介
    WinCE下用STL的奇怪问题
    STL(三)string
  • 原文地址:https://www.cnblogs.com/yidianfeng/p/1798343.html
Copyright © 2011-2022 走看看