private void button1_Click_1(object sender, EventArgs e) { string compname = textBoxcomrpt.Text; cnn.Open(); string query = "select * from Ageingrpt where Companyname='" + compname + "';"; MySqlCommand cmd = new MySqlCommand(query, cnn); // MySqlDataReader reader = cmd.ExecuteReader(); // query will be executed and data saved to the db DataSet dat = new DataSet(); MySqlDataAdapter cmd1 = new MySqlDataAdapter(query, cnn); cmd1.Fill(dat, "DataTable1"); CrystalReportAgeing1.Load("CrystalReportAgeing.rpt"); //crystalReportViewer1.Load("CrystalReport3"); CrystalReportAgeing1.SetDataSource(dat); crystalReportViewer1.ReportSource = CrystalReportAgeing1; cnn.Close(); }
private void Ageing_Load(object sender, EventArgs e) { Ageingcalc1(); cnn.Open(); string query = "select * from Ageingrpt;"; MySqlCommand cmd = new MySqlCommand(query, cnn); // MySqlDataReader reader = cmd.ExecuteReader(); // query will be executed and data saved to the db DataSet dat = new DataSet(); MySqlDataAdapter cmd1 = new MySqlDataAdapter(query, cnn); cmd1.Fill(dat, "DataTable1"); CrystalReportAgeing1.Load("CrystalReportAgeing.rpt"); //crystalReportViewer1.Load("CrystalReport3"); CrystalReportAgeing1.SetDataSource(dat); crystalReportViewer1.ReportSource = CrystalReportAgeing1; cnn.Close(); }