SqlConnection conn = conString.getCon(); ReportDocument cy = new ReportDocument(); dt1 ds = new dt1(); conn.Open(); cy.Load(Application.StartupPath + @"\crpt.rpt"); SqlDataAdapter da = new SqlDataAdapter("exec viewInfo @gen", conn); da.SelectCommand.Parameters.AddWithValue("@gen", txtGender.Text); da.Fill(ds.Info); cy.SetDataSource(ds); crystalReportViewer1.ReportSource = cy; conn.Close();
ParameterFields pField = new ParameterFields(); ParameterField pTitle = new ParameterField(); ParameterDiscreteValue pValue = new ParameterDiscreteValue(); pTitle.ParameterFieldName = "Gen"; //the name of the field @ Crystal Report pValue.Value = txtGender.Text; //sending the text box value pTitle.CurrentValues.Add(pValue); pField.Add(pTitle); crystalReportViewer1.ParameterFieldInfo = pField; crpt objBT = new crpt(); objBT.Refresh(); crystalReportViewer1.ReportSource = objBT;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)