Exemple #1
0
        // Getting evaluation modes from Database and apply to the labels
        public void Get_Evaluation_Modes_For_Labels()
        {
            string commandText1 = "SELECT * from Evaluation where subject_id = (SELECT subject_id FROM Subject where subject_name = @s2_name)";

            try
            {
                using (SqlCommand cmd = new SqlCommand(commandText1, sqlConnection1))
                {
                    cmd.Parameters.AddWithValue("@s2_name", SubjectComboBox.SelectedItem);
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        Eval_1_Marks_Label.Text = "Marks for " + reader.GetString(1) + " :";
                        Eval_2_Marks_Label.Text = "Marks for " + reader.GetString(2) + " :";
                        Eval_3_Marks_Label.Text = "Marks for " + reader.GetString(3) + " :";
                    }
                    reader.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            Eval_1_Marks_txtbox.Clear();
            Eval_2_Marks_txtbox.Clear();
            Eval_3_Marks_txtbox.Clear();
        }
        private void Eval_2_Marks_txtbox_Leave(object sender, EventArgs e)
        {
            int number;

            if (int.TryParse(Eval_2_Marks_txtbox.Text, out number))
            {
                if (number < 0 || number > 25)
                {
                    Eval_2_Marks_txtbox.Clear();
                    MessageBox.Show("Enter Between 0 and 25 only");
                }
            }
        }