private void studentResult() { this.chart8.Series["Student"].Points.AddXY("Boys(" + Mgender.ToString() + ")", Mgender); this.chart8.Series["Student"].Points.AddXY("Girls(" + (id - Mgender).ToString() + ")", (id - Mgender)); this.chart9.Series["Result"].Points.AddXY("Pass(" + Passresult.ToString() + ")", Passresult); this.chart9.Series["Result"].Points.AddXY("Fail(" + (id - Passresult).ToString() + ")", (id - Passresult)); }
private void marks_Calculation() { int totalStudent = id; Passresult = 0; Mgender = 0; for (int i = 1; i <= id; i++) { string constring = "datasource=localhost;port=3306;username=root;password=12345"; string Query = "select * from class_database.class_2 where id= '" + i + "' ;"; MySqlConnection conDatabase = new MySqlConnection(constring); MySqlCommand cmdDatabase = new MySqlCommand(Query, conDatabase); MySqlDataReader myReader; conDatabase.Open(); try { myReader = cmdDatabase.ExecuteReader(); // MessageBox.Show("Data has been Updated " + comboBox1.Text); if (myReader.Read()) { //MessageBox.Show("Data has been Updated"); //myReader.Read(); string gender = myReader.GetString("gender"); string result = myReader.GetString("result"); if (result == "PASS") { Passresult += 1; } if (gender == "Male") { Mgender += 1; } // myReader.Read(); } myReader.Close(); conDatabase.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } label2.Text = "Number of Student = " + totalStudent.ToString(); label3.Text = "Number of Boys = " + Mgender.ToString(); label4.Text = "Number of Girls = " + (totalStudent - Mgender).ToString(); label5.Text = "Number of Passed Student = " + Passresult.ToString(); }