私はもう一度ここにこだわっていますが、問題の原因がわかりません! さて、私はコードを書いたCで削除ボタンを持っていて、毎回実行すると、メッセージが "よく削除されました"が表示されますが、私のアプリケーションを再起動すると、SQLサーバーのデータベースでも、ボタンの削除がCでうまく実行されない#
SqlConnection sqlCon = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
SqlCommand cmd = new SqlCommand();
SqlDataAdapter reader = new SqlDataAdapter();
sqlCon.Open();
string requete = "DELETE FROM [RECAP] where code_reseau='" + textBox1.Text + "' and gch_dep='" + comboBox2.SelectedText + "' and typ_port='" + comboBox3.SelectedText + "' and mois = " +Form3.mois+" and annee = "+Form3.annee+" ";
cmd = new SqlCommand(requete, sqlCon);
cmd.ExecuteNonQuery();
MessageBox.Show("Supprimé !");
sqlCon.Close();
'cmd.ExecuteNonQuery()'の戻り値は何ですか?何も削除していないことを示していますか? – UnholySheep
さて、あなたはSQLインジェクション攻撃を開始しています。 – Martijn