0
Reply

dyanmic crystal report

mayank jain

mayank jain

Jun 17 2009 8:04 AM
2.8k

hi frnds
i am gernetang crystal report from stored procedure on ei pass my parameter thn report is genertaing but whn i pass two parameters it shows an error   'The parameter is incorrect.'    plz tel me the soultion my code is
{
ReportDocument reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
paramField.Name =
"@Dept";
paramDiscreteValue.Value = TextBox1.Text.ToString();
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
paramField.Name =
"@Name";
paramDiscreteValue.Value = TextBox2.Text.ToString();
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
CrystalReportViewer1.ParameterFieldInfo = paramFields;
reportDocument.Load(Server.MapPath(
"CrystalReport.rpt"));
CrystalReportViewer1.ReportSource = reportDocument;
reportDocument.SetDatabaseLogon(
"sa", "sa", "OPWFMS-7KYGZ7SB", "test");
}