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、运行
  • 相关阅读:
    PHP闭包的用法
    composer相关命令
    keepalievd
    docker-compose
    rabbitmq 知识点
    免费的mysql客户端管理工具
    git生成密钥
    rabbitmq在docker下进行cluster
    http状态码
    vmplayer固定IP
  • 原文地址:https://www.cnblogs.com/yidianfeng/p/1798343.html
Copyright © 2011-2022 走看看