1
I am creating a c# report using SAP Crystal Reports, my report contains a subReport when I view the report by Visual Studio in the report edit mode it fills the data in the normal subReport, however when I call him in the program he only brings the data only main report and does not bring from subReport. Below is the code I’m using to call the report.
DataTable dtReceituario = _objAgroReceituarioControl.ImpressaoCabecalho(ReceituarioID);
DataTable dtItens = _objAgroReceituarioItensControl.ImpressaoReceituario(ReceituarioID);
_objCrypto = new clsConfigXml();
CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new ReceituarioAgrotech();
ParameterFields paramFields = new ParameterFields();
ParameterField paramField1 = new ParameterField();
ParameterField paramField2 = new ParameterField();
ParameterField paramField3 = new ParameterField();
ParameterField paramField4 = new ParameterField();
ParameterDiscreteValue Agronomo = new ParameterDiscreteValue();
ParameterDiscreteValue Endereco = new ParameterDiscreteValue();
ParameterDiscreteValue CPF = new ParameterDiscreteValue();
ParameterDiscreteValue CREA = new ParameterDiscreteValue();
Agronomo.Value = objConfigInfo.Config_Agronomo_Nome;
paramField1.ParameterFieldName = "Agronomo";
paramField1.CurrentValues.Add(Agronomo);
paramFields.Add(paramField1);
Endereco.Value = objConfigInfo.Config_Agronomo_Endereco;
paramField2.ParameterFieldName = "Endereco";
paramField2.CurrentValues.Add(Endereco);
paramFields.Add(paramField2);
CPF.Value = objConfigInfo.Config_Agronomo_CPF;
paramField3.ParameterFieldName = "CPF";
paramField3.CurrentValues.Add(CPF);
paramFields.Add(paramField3);
CREA.Value = objConfigInfo.Config_Agronomo_CREA;
paramField4.ParameterFieldName = "CREA";
paramField4.CurrentValues.Add(CREA);
paramFields.Add(paramField4);
rpt.SetDatabaseLogon(_objCrypto.Usuario, _objCrypto.Senha, _objCrypto.Servidor, _objCrypto.BancoDados);
rpt.SetDataSource(dtItens);
FrmVisualizaRelatorios frmViewRell = new FrmVisualizaRelatorios();
CrystalDecisions.CrystalReports.Engine.ReportDocument rptDadosReceituario;
rptDadosReceituario = rpt.OpenSubreport("vDadosReceituario.rpt");
rptDadosReceituario.SetDatabaseLogon(_objCrypto.Usuario, _objCrypto.Senha, _objCrypto.Servidor, _objCrypto.BancoDados);
rptDadosReceituario.SetDataSource(dtReceituario);
frmViewRell.crystalReportViewer1.ReportSource = rpt;
frmViewRell.crystalReportViewer1.ParameterFieldInfo = paramFields;
frmViewRell.ShowInTaskbar = false;
frmViewRell.ShowDialog();