• 水晶报表相关


    服务器部署水晶报表的一些资料:

    http://www.cnblogs.com/babyt/archive/2008/02/19/1073688.html

    http://www.cnblogs.com/babyt/archive/2008/11/20/1337181.html

    http://www.cnblogs.com/babyt/category/120552.html

    Crystal Reports v. 9.1 to 12.x VS .NET Runtime Distribution & Supported Operating Systems:

    .net环境下,水晶报表从9.112.x的组件列表。

    http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=56787567

     

     

    水晶报表格式。

    a4纸张.字体9.或10.默认边缘.字段多。可以横打.

    具体步骤

    1.建立xsd.(可以用unbound filed 来建立一些其他字段.这样就方便了)

    2.建立rpt文件.拖进字段来布局报表.

    3.防入aspx中。写代码

     

    代码贴出一个.纪录下。

     

    aspx:

    <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="false" Width="96%" OnNavigate="changepage"/>

     

    cs:

     

    namespace lanvin
    {
        //这里后期要判断,页是否大于最大.如果是,要附加到session中.
        public partial class customer_showrp : System.Web.UI.Page
        {
            BLL.comm bllcomm = new BLL.comm();
            public DataSet ds = new DataSet();
            public DataTable dt = new DataTable();
            public int pagesize = 25;
            public int maxpage = 500;

            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    string intfrom = Request.QueryString["intfrom"];
                    string intto = Request.QueryString["intto"];
                    string fromm = Request.QueryString["fromm"];
                    string tomm = Request.QueryString["tomm"];
                    string fromvip = Request.QueryString["fromvip"];
                    string tovip = Request.QueryString["tovip"];

                    string checkboxlist = Request.QueryString["checkboxlist"];
                    if (checkboxlist != "")
                    {
                        checkboxlist = checkboxlist.Replace(",", "','");
                        checkboxlist = "'" + checkboxlist + "'";
                    }

                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(" where ");
                    if (checkboxlist != "") sb.Append(" ([shop no] in (" + checkboxlist + ")) and ");
                    if (intfrom != "") sb.Append(" ([date]>='" + intfrom + "') and ");
                    if (intto != "") sb.Append(" ([date]<='" + intto + "') and ");

                    if (fromm != "" && tomm != "") sb.Append("([member number]>='" + fromm + "' and [member number]<='" + tomm + "') and ");
                    else if (fromm != "" && tomm == "") sb.Append("([member number]='" + fromm + "') and ");
                    if (fromvip != "" && tovip != "") sb.Append("([vip number]>='" + fromvip + "' and [vip number]<='" + tovip + "') and ");
                    else if (fromvip != "" && tovip == "") sb.Append("([vip number]='" + fromvip + "') and ");
                    sb.Append(" (1=1) ");

                    ViewState["where"] = sb.ToString();

                    ReportDocument rptDocu = new ReportDocument();
                    rptDocu.Load(Server.MapPath("demo.rpt"));
                    rptDocu.SetDatabaseLogon("sa", "sa");

                    string sqllast = "select top "+pagesize*maxpage+" * from v_report_SH " + (ViewState["where"] == null ? "where (1=3)" : ViewState["where"].ToString() + " order by [date] desc,[member number]");
                    Trace.Write(sqllast);
                    try
                    {
                        dt = bllcomm.simplesqlexcuteAccpac(sqllast);
                    }
                    catch
                    {
                        //throw;
                        Function.JScript.Alert("timeout or other error!try again!", this.Page);
                        dt = new DataTable();
                    }

                    ds.Tables.Add(dt);
                    ds.Tables[0].TableName = "v_report_SH";

                    Session["myds"] = ds;

                    rptDocu.SetDataSource(ds);
                    this.CrystalReportViewer1.DisplayGroupTree = false;
                    this.CrystalReportViewer1.ReportSource = rptDocu;
                }
                else
                {
                    sureds();
                }
            }

            public void changepage(object sender, CrystalDecisions.Web.NavigateEventArgs e)
            {
                sureds();
            }

            private void sureds()
            {
                ReportDocument rptDocu = new ReportDocument();
                rptDocu.Load(Server.MapPath("demo.rpt"));
                rptDocu.SetDatabaseLogon("sa", "sa");

                if (Session["myds"] != null)
                {
                    ds = (DataSet)Session["myds"];
                }
                else
                {
                    if (ViewState["where"] != null)
                    {
                        string sqllast = "select top "+pagesize*maxpage+" * from v_report_SH " + (ViewState["where"] == null ? "where (1=3)" : ViewState["where"].ToString() + " order by [date] desc,[member number]");
                        try
                        {
                            dt = bllcomm.simplesqlexcuteAccpac(sqllast);
                            ds.Tables.Add(dt);
                        }
                        catch
                        {
                            //throw;
                            Function.JScript.Alert("timeout or other error!try again!", this.Page);
                            dt = new DataTable();
                            ds.Tables.Add(dt);
                        }
                    }
                }
                rptDocu.SetDataSource(ds);
                this.CrystalReportViewer1.DisplayGroupTree = false;
                this.CrystalReportViewer1.ReportSource = rptDocu;
            }
        }
    }

  • 相关阅读:
    Update SSM agent to each EC2 via Bat and bash script
    Shell脚本循环读取文件中的每一行
    通过psexec实现远程安装软件包
    Getting Private/Public IP address of EC2 instance using AWS-cli [closed]
    Python to list users in AWS
    BAT script to set local account password never expire
    Difference between Netbios and Host name
    PowerShell官方文档
    powershell for rename server name
    Create a conditional DNS forwarder on our domain.com to Amazon default DNS provider
  • 原文地址:https://www.cnblogs.com/lsfv/p/1674160.html
Copyright © 2020-2023  润新知