kaoutarac
Messages postés26Date d'inscriptionmercredi 15 décembre 2010StatutMembreDernière intervention 6 septembre 2012
-
14 avril 2011 à 17:56
cs_Megafan
Messages postés389Date d'inscriptiondimanche 7 avril 2002StatutMembreDernière intervention23 septembre 2016
-
17 avril 2011 à 09:20
bonjour
je veux supprimer des donnees de type datatime a partir d'un programme c# mais le probleme c est que apres l'execusion le programme m affiche que les donnes sont supprime en revanche rien n a ete change au niveau de la base donne j ai toujours les donnes comprises entre l intrevale du temps
pouvez vous m aidez dans ce problem je suis bloque
mon code est le suivant
private void Delete_Click(object sender, EventArgs e)
{
try
{
DateTime D1 = Convert.ToDateTime(yearstart.Text + "/" + monthstart.Text + "/" + daystart.Text + " 00:00:00.000");
DateTime D2 = Convert.ToDateTime(yearend.Text + "/" + monthend.Text + "/" + dayend.Text + " 00:00:00.000");
// SqlCommand myCommand = new SqlCommand("select* from Operation,Lots,Data where Operation.Num=Lots.Num and Data.Date textBox1 Operation.Start_Date and Operation.End_Date and Data.Date_Now textBox1 "+Convert.ToDateTime(startpurge.Text)+" and "+Convert.ToDateTime(Endpurge.Text), Program.Connexion);
// SqlCommand myCommand = new SqlCommand("select* from Operation,Lots,Data where Operation.Num=Lots.Num and Data.Date textBox1 Operation.Start_Date and Operation.End_Date", Program.connexion);
// DELETE FROM OpEnCours where Label='" + EtuveASupprimer + "'", Program.connexion);
/*
SqlCommand myCommand3 = new SqlCommand("DELETE from Lots where Lots.Num in(select Lots.Num from Operation,Lots where Operation.Num=Lots.Num and Operation.Start_Date between '" + D1 + "' and '" + D2 + "') ", Program.connexion);
myCommand3.ExecuteReader();
Program.connexion.Close();*/
Program.connexion.Open();
SqlCommand myCommand = new SqlCommand("DELETE from Live_Operation where End_Date between '" + D1 + "' and '" + D2 + "'", Program.connexion);
myCommand.ExecuteReader();
Program.connexion.Close();
Program.connexion.Open();
/* SqlCommand commande = new SqlCommand("DELETE from Data where Date_Now between '" + D1 + "' and '" + D2 + "'", Program.connexion);
commande.ExecuteNonQuery(); */
richTextBox.Text = "\n Archives between " + monthstart.Text + "/" + daystart.Text + "/" + yearstart.Text + " and " + monthend.Text + "/" + dayend.Text + "/" + yearend.Text + " are deleted succefully...";
}
catch (Exception) { richTextBox.Text = "\nNo data... "; }
Program.connexion.Close();
}
kaoutarac
Messages postés26Date d'inscriptionmercredi 15 décembre 2010StatutMembreDernière intervention 6 septembre 2012 15 avril 2011 à 11:18
Bonjour
j ai déjà essai avec myCommand.ExecuteNonQuery();
Mais j ai toujours des champs comprises entre l intervalle sélectionné qui ne sont pas supprimées
merci