本文介绍了如何调用准结晶报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
private void ReceivePuchasePrint_Load(object sender, EventArgs e)
{
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(rptName);
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables crTables;
TableLogOnInfo crTableLogonInfo = new TableLogOnInfo();
crConnectionInfo.DatabaseName = ConfigurationSettings.AppSettings["ReportDB"].ToString();
crConnectionInfo.Password = ConfigurationSettings.AppSettings["ReportPwd"].ToString();
crConnectionInfo.ServerName = ConfigurationSettings.AppSettings["ReportServer"].ToString();
crConnectionInfo.UserID = ConfigurationSettings.AppSettings["ReportLogin"].ToString();
crTables = cryRpt.Database.Tables;
crPrintOptions = cryRpt.PrintOptions;
foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
{
crTableLogonInfo = crTable.LogOnInfo;
crTableLogonInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogonInfo);
}
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["@VNo"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterDiscreteValue.Value = strGetVNo;
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
if (strGetSrNo != "")
{
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["@SrNo"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterDiscreteValue.Value = strGetSrNo;
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
}
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();
}
ReceivePuchasePrint rpt = new ReceivePuchasePrint();
ReceivePuchasePrint.strGetVNo = sendVoucher;
ReceivePuchasePrint.strGetSrNo = string.Empty;
ReceivePuchasePrint.rptName = "D:\\Imported\\Imported\\NewFolder1\\rptReceivePurchase1.rpt";
rpt.ShowDialog();
rpt = null;
推荐答案
这篇关于如何调用准结晶报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!