Bhavesh Vankar

Bhavesh Vankar

  • 1.2k
  • 998
  • 37.5k

Crystal Report Occur error while open form

Apr 23 2020 8:55 AM
occur error for below line....
 this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
 
when i press the button report viewer form open and when i am enter perticular id into textbox only entered id's reocrd print on the report. 
my button code is here....
 try
            {
                Bonafied_Certificateform frm = new Bonafied_Certificateform();
                frm.Show();
                SqlConnection conn = new SqlConnection(@"Data Source=DIVYANSHI-PC\DEVINE;Initial Catalog=SMS;Integrated Security=True");
                conn.Open();
                string selectdata = "Select * from STUDENT_DETAILS Where UNIQUEID='" + StudentID.Text + "'";
                SqlCommand cmd = new SqlCommand(selectdata, conn);
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                DataSet ds = new DataSet();
                sda.Fill(ds, "STUDENT_DETAILS");
                CrystalReport1 crpt1 = new CrystalReport1();
                crpt1.SetDataSource(ds);
                frm.crystalReportViewer1.ReportSource = crpt1;
                frm.crystalReportViewer1.Refresh();
                conn.Close();
            }
            catch (Exception ec)
            {
                MessageBox.Show(ec.Message);
            }
            finally
            {
           
            }
 
kindly please help me in this problem.....
 

Answers (1)