-4
以下
<asp:Label ID="Label1" runat="server" Text="Email'e Göre Silin"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Sil" />
とテキストボックスとボタンを追加しましたが、私のクエリは、これらのために働くではありません。
SqlConnection con = new SqlConnection("Data Source=DESKTOP-VQUBBVP\\SQLEXPRESS; initial catalog=UgurBocegiDatabase; Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand("delete from tblMessage where Email = '"+TextBox1.Text+ "' ", con);
cmd.ExecuteNonQuery();
以下のように追加しようとしましたが、もう一度動作しませんでした。
SqlCommand cmd = new SqlCommand("delete from tblMessage where Email = '"+TextBox1.Text.ToString()+ "' ", con);
とクエリが
delete from tblMessage where Email = 'gs213'
問題は何である以下のようにSQL Serverで動作しますか?
**警告**あなたのコードは、SQLインジェクション攻撃に対して非常に脆弱です。 –
決して、家庭でこれを行うことはありません。 – TigOldBitties
[尋ねる]を読んで、「うまくいかない」ことを詳述してください。 – CodeCaster