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;
reportDocument.SetDataSource(datatable); reportDocument.SetParameterValue("Name", TextBox1.Text); CrystalReportViewer1.ReportSource = reportDocument;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)