2
Answers

there is no error but it never show the report

my source is
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
AutoDataBind="True" DisplayPage="False" ReportSourceID="CrystalReportSource2"
Width="500px" BestFitPage="False" Height="800px" />
<CR:CrystalReportSource ID="CrystalReportSource2" runat="server">
<Report FileName="Cashvoucher.rpt">
</Report>
</CR:CrystalReportSource>
 
my code is
 
ReportDocument reportdocument = new ReportDocument();
string iid = Request.QueryString["id"].ToString();
ParameterFields paramFields = new ParameterFields();
ParameterField paramField = new ParameterField();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
paramField.Name = "id";
paramDiscreteValue.Value = iid;
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
CrystalReportViewer1.ParameterFieldInfo = paramFields;
reportdocument.Load(Server.MapPath("Cashvoucher.rpt"));
reportdocument.SetParameterValue("id", iid);
// string str = "select id,Name,Section,Details,advance from salary where id='" + iid + "'";
string str = "select Name,daysinmonth,presentdays from salary where id='" + iid + "'";
DataSet ds = mvl.GETDS(str);
reportdocument.SetDataSource(ds.Tables[0]);
CrystalReportViewer1.ReportSource = reportdocument;
//CrystalReportViewer1.RefreshReport();
}
 
Answers (2)