I am Try to pass text box values to crystal report in asp.net.
but it will not fount parameter in my code. it will show popup parameter dialog box window to get value for crystal report.
ReportDocument reportDocument = new ReportDocument();
ParameterFields paramFields = new ParameterFields();
ParameterField paramField = new ParameterField();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
paramField.Name = "@Name";
paramDiscreteValue.Value = TextBox1.Text.ToString();
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
CrystalReportViewer1.ParameterFieldInfo = paramFields;
reportDocument.Load(Server.MapPath("CrystalReport1.rpt"));
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
conn.Open();
string sql = "select * from CustomerDetails";
OdbcCommand cmd = new OdbcCommand(sql, conn);
OdbcDataAdapter dscmd = new OdbcDataAdapter(cmd);
DataTable datatable = new DataTable();
dscmd.Fill(datatable);
conn.Close();
reportDocument.SetDataSource(datatable);
CrystalReportViewer1.ReportSource = reportDocument;
If anybody Knows please help me..