示例#1
0
    private void BindReport()
    {
        try
        {
            GPreportdatewise.DisplayToolbar = false;
            GPreportdatewise.ToolPanelView  = CrystalDecisions.Web.ToolPanelViewType.None;
            GPreportdatewise.Zoom(100);
            GPreportdatewise.HasExportButton               = false;
            GPreportdatewise.HasPrintButton                = false;
            GPreportdatewise.HasToggleGroupTreeButton      = false;
            GPreportdatewise.HasToggleParameterPanelButton = false;
            GPreportdatewise.HasZoomFactorList             = false;
            GPreportdatewise.HasCrystalLogo                = false;
            GPreportdatewise.Font.Size = 8;
            GPreportdatewise.GroupTreeStyle.Font.Size = 8;
            GPreportdatewise.GroupTreeStyle.ShowLines = false;
            GPreportdatewise.ToolbarStyle.Width       = Unit.Parse("2046px");
            rpt.Load(Server.MapPath("~/reports/duplicatebill.rpt"));
            ConnectionInfo conInfo = new ConnectionInfo();
            {
                var withBlock = conInfo;
                withBlock.ServerName   = "WIN-H4F4JGGN50A";
                withBlock.DatabaseName = "kmc";
                withBlock.UserID       = "sa";
                withBlock.Password     = "******";
            }

            foreach (CrystalDecisions.CrystalReports.Engine.Table MyTable in rpt.Database.Tables)
            {
                TableLogOnInfo MyTableLogonInfo = MyTable.LogOnInfo;
                MyTableLogonInfo.ConnectionInfo = conInfo;
                MyTable.ApplyLogOnInfo(MyTableLogonInfo);
            }

            //"{invoice.consumer_no} = '" + txtconsumerno.Text.ToString + "' and {invoice.status} = 1";

            rpt.ReadRecords();
            GPreportdatewise.ReportSource = rpt;
            rpt.RecordSelectionFormula    = "{invoice.consumer_no} = '" + txtconsumerno.Text + "' and {invoice.status} = 1";
            GPreportdatewise.RefreshReport();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }