string Schedule()
    {
        string          activite = ddl_ajout_date.SelectedValue;
        string          Schedule = " ";
        MySqlCommand    HorraireCommand;
        MySqlDataReader ScheduleReader;

        //while (QuestionReader.Read())
        if (Connection != null)
        {
            HorraireCommand             = Connection.CreateCommand();
            HorraireCommand.CommandText = "Select NumeroActivite from activites where TitreActivite ='" + activite + "'";
            ScheduleReader = HorraireCommand.ExecuteReader();
            if (ScheduleReader.Read())
            {
                Schedule = ScheduleReader["NumeroActivite"].ToString();
            }
            ScheduleReader.Close();
        }
        else
        {
            //connexion non réussie
            Response.Redirect("default.aspx");
        }
        return(Schedule);
    }
Esempio n. 2
0
    void ShowSchedule()
    {
        lit_horraire.Text = " ";
        lbl_activite.Text = " ";
        string          Activtity = ddl_choix_horraire.SelectedValue;
        string          no_act    = " ";
        string          jour      = " ";
        string          date      = " ";
        string          heure     = " ";
        string          precision = " ";
        MySqlCommand    ScheduleCommand;
        MySqlDataReader ScheduleReader;

        Connection.Open();
        //while (QuestionReader.Read())
        if (Connection != null)
        {
            ScheduleCommand             = Connection.CreateCommand();
            ScheduleCommand.CommandText = "Select NumeroActivite from activites where TitreActivite ='" + Activtity + "'";
            ScheduleReader = ScheduleCommand.ExecuteReader();
            if (ScheduleReader.Read())
            {
                no_act            = (ScheduleReader["NumeroActivite"]).ToString();
                lbl_activite.Text = Activtity;
            }
            ScheduleReader.Close();
            ScheduleCommand             = Connection.CreateCommand();
            ScheduleCommand.CommandText = "Select Jour, Date, Heure, Precisions from horaires where NumeroActivite ='" + no_act + "'";
            ScheduleReader = ScheduleCommand.ExecuteReader();
            while (ScheduleReader.Read())
            {
                jour              = ScheduleReader["Jour"].ToString();
                date              = ScheduleReader["Date"].ToString();
                heure             = ScheduleReader["Heure"].ToString();
                precision         = ScheduleReader["Precisions"].ToString();
                lit_horraire.Text = lit_horraire.Text + "<p>" + "Jour(s) : " + jour + " / " + "Date(s) : " + date + " / " + "Heure(s) : " + heure + " / " + "Précision(s) :" + precision + "</p>";
            }
            Connection.Close();
        }
        else
        {
            //connexion non réussie
            Response.Redirect("default.aspx");
        }
    }