これは私の仕事です。問題はcmd.ExecuteNonQuery
で発生します。Cmd executenonquery
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'Order'.
Source Error: Line 44:cmd.ExecuteNonQuery();
protected void Button2_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("insert into Order values('" +DropDownList1.SelectedValue+"','" +DropDownList2.SelectedValue+ "','" +txtQuantity.Text+ "','" +DropDownList3.SelectedValue+ "','" +TextBox1.Text+ "')", con);
cmd.ExecuteNonQuery();
con.Close();
DropDownList1.SelectedValue= "";
DropDownList2.SelectedValue = "";
txtQuantity.Text = "";
DropDownList3.SelectedValue= "";
TextBox1.Text = "";
}
my TextBox1.Text = 'bob ');ドロップテーブル - ' –
SQLインジェクションの脆弱性を削除することを検討してください。このようなサンプルコードは、プロトタイプコードでも恐ろしいものです。プロダクトにすることができるからです。それはあなたのワークベンチの上に横たわっているダイナマイトの棒を残すようなものです... – DVK