1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
public static bool ajouterVideo(Video v)
{
MySqlCommand command = new MySqlCommand();
command.Connection = connection;
command.CommandText = "INSERT INTO film (Titre,Duree,Resumer,Annee,Genre) VALUES(@Titre,@Duree,@Resumer,@Annee,)";
command.Parameters.AddWithValue("@Titre", v.GetTitre());
command.Parameters.AddWithValue("@Duree", v.GetDuree());
command.Parameters.AddWithValue("@Annee", v.GetAnnee());
command.Parameters.AddWithValue("@Resumer", v.GetResumer());
command.CommandText = " update film FROM `genre` WHERE `LibelleGenre` = @Genre";
command.Parameters.AddWithValue("@Genre", v.GetGenre());
int nbrows;
try
{// récupérer le nombre de lignes affectées
nbrows = command.ExecuteNonQuery();
}
catch
{
nbrows = 0;
}
if (nbrows > 0)
return true;
else
return false;
} |
Partager