本文整理汇总了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());
}
}
示例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());
}
}