当前位置: 首页>>代码示例>>C#>>正文


C# ReportDocument.VerifyDatabase方法代码示例

本文整理汇总了C#中ReportDocument.VerifyDatabase方法的典型用法代码示例。如果您正苦于以下问题:C# ReportDocument.VerifyDatabase方法的具体用法?C# ReportDocument.VerifyDatabase怎么用?C# ReportDocument.VerifyDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ReportDocument的用法示例。


在下文中一共展示了ReportDocument.VerifyDatabase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowGenericRpt

        public void ShowGenericRpt()
        {
            try
            {
                bool isValid = true;

                string strReportName = System.Web.HttpContext.Current.Session["ReportName"].ToString();    // Setting ReportName

                if (string.IsNullOrEmpty(strReportName))
                {
                    isValid = false;
                }

                if (isValid)
                {
                    ReportDocument rd = new ReportDocument();
                    string strRptPath = System.Web.HttpContext.Current.Server.MapPath("~/") + "Report//" + strReportName;
                    rd.Load(strRptPath);
                    rd.VerifyDatabase();
                    rd.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "crReport");
                    // Clear all sessions value
                    Session["ReportName"] = null;
                }
                else
                {
                    Response.Write("<H2>Nothing Found; No Report name found</H2>");
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
开发者ID:NguyenHoangDuy,项目名称:MVC_ESM,代码行数:33,代码来源:GenericReportViewerController.cs

示例2: ReportViewer_Load

        private void ReportViewer_Load(object sender, EventArgs e)
        {
            try
            {
                _reportDocument = new ReportDocument();
                _reportDocument.Load(_reportPath);
                _reporterBO.SetCrystalReportLogon(_reportDocument);

                if (TemplateBased)
                {
                    System.Data.DataTable dt = _reporterBO.GetDataTableFromTemplateSqlStmt();

                    _reportDocument.Database.Tables["Command"].SetDataSource(dt);
                    _reportDocument.VerifyDatabase();

                    string groups = string.Empty;
                    for (int i = 0; i < _reporterBO.TemplateGroupFields.Count; i++)
                    {
                        //assign the GroupFields from the form to the Grp1, Grp2, etc formulas in the report
                        _reportDocument.DataDefinition.FormulaFields["Grp" + (i + 1).ToString()].Text = "{Command.G" + (i+1).ToString() + "_" + _reporterBO.TemplateGroupFields[i].ColumnAlias + "}";
                        _reportDocument.DataDefinition.FormulaFields["Grp" + (i + 1).ToString() + "Title"].Text = string.Format("'G{0}_{1}'",(i+1).ToString(),_reporterBO.TemplateGroupFields[i].ColumnAlias);

                        //assign the GroupFields from the form to the Group Conditions in the report
                        //DatabaseFieldDefinition dfd = _reportDocument.Database.Tables["Command"].Fields[string.Format("G{0}_{1}", (i + 1).ToString(), _reporterBO.TemplateGroupFields[i].ColumnAlias)];
                        //_reportDocument.DataDefinition.Groups[i].ConditionField = dfd;

                        //assign the GroupFields from the form to the Wizard Selection | Groups formula in the report
                        if (groups == string.Empty)
                            groups = _reporterBO.TemplateGroupFields[i].ColumnAlias;
                        else
                            groups = groups + ", " + _reporterBO.TemplateGroupFields[i].ColumnAlias;
                    }
                    _reportDocument.DataDefinition.FormulaFields["Groups"].Text = string.Format("'{0}'", groups);

                    string selectedFields = string.Empty;
                    for (int i = 0; i < _reporterBO.TemplateSelectedFields.Count; i++)
                    {
                        //assign the SelectedFields from the form to the Col1, Col2, etc formulas in the report
                        _reportDocument.DataDefinition.FormulaFields["Col" + (i + 1).ToString()].Text = "{Command." + _reporterBO.TemplateSelectedFields[i].ColumnAlias + "}";
                        _reportDocument.DataDefinition.FormulaFields["Col" + (i + 1).ToString() + "Title"].Text = string.Format("'{0}'",_reporterBO.TemplateSelectedFields[i].ColumnAlias);

                        //assign the SelectedFields from the form to the Wizard Selection | SelectedFields formula in the report
                        if (selectedFields == string.Empty)
                            selectedFields = _reporterBO.TemplateSelectedFields[i].ColumnAlias;
                        else
                            selectedFields = selectedFields + ", " + _reporterBO.TemplateSelectedFields[i].ColumnAlias;
                    }
                    _reportDocument.DataDefinition.FormulaFields["SelectedFields"].Text = string.Format("'{0}'", selectedFields);

                    string filters = string.Empty;
                    string filtersFormula = string.Empty;
                    for (int i = 0; i < _reporterBO.TemplateFilterStatement.Count; i++)
                    {
                        //assign the FilterStatement from the form to the Wizard Selection | Filters formula in the report
                        if (filters == string.Empty)
                            filters = _reporterBO.TemplateFilterStatement[i];
                        else
                            filters = filters + ", " + _reporterBO.TemplateFilterStatement[i];

                        if (filtersFormula == string.Empty)
                            filtersFormula = _reporterBO.TemplateFilterStatement[i];
                        else
                            filtersFormula = filters + ", " + _reporterBO.TemplateFilterStatement[i];
                    }
                    _reportDocument.DataDefinition.FormulaFields["Filters"].Text = string.Format("'{0}'", filters);
                    _reportDocument.DataDefinition.RecordSelectionFormula = filtersFormula;

                    _reportDocument.DataDefinition.FormulaFields["Datasource"].Text = string.Format("'{0}'", _reporterBO.TemplateDataSource.ReportWizardDataSourceName);
                }
                else
                {
                    if (_reporterBO.HasParameterSetNameArg)
                        _reporterBO.CreateParameterCollection(_reportDocument.ParameterFields);
                    else
                        GetParametersFromUser();
                }

                //LeftAlignDetailsReportObjects();

                this.crystalReportViewer.ReportSource = _reportDocument;
            }
            catch (Exception ex)
            {
                _reporterBO.Log(ex.ToString());
            }
        }
开发者ID:HutsonSoftware,项目名称:Reporter,代码行数:86,代码来源:ReportViewer.cs


注:本文中的ReportDocument.VerifyDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。