【发布时间】:2013-11-25 19:54:37
【问题描述】:
string CommandText = "insert into dbo.printing_list(batch_code,bill_no,date,sr_no,gross_wt,core_wt,nett_wt,c_id,category) values('" +
comboBox2.Text.ToString() +
"','" + textBox1.Text.ToString() + "','" +
dateTimePicker1.Value + "','" +
dataGridView1.Rows[i].Cells[1].Value + "','" +
Convert.ToDecimal(dataGridView1.Rows[i].Cells[2].Value) +
"','" + Convert.ToDecimal(label2.Text.ToString()) + "','" +
dataGridView1.Rows[i].Cells[3].Value + "','" + g + "','" +
comboBox1.Text.ToString() + "')";
【问题讨论】:
-
问题是什么?
-
请尝试search,您不是第一个遇到此错误的人。 :)
-
@CodeCaster: 2742 次点击 :-) 绝对 不是第一个.....
-
SQL Injection alert - 您应该不将您的 SQL 语句连接在一起 - 使用 参数化查询 来避免 SQL 注入
-
欢迎来到 Stackoverflow。首先,您应该阅读FAQ 和How to Ask 几次。其次,您应该始终使用parameterized queries。这种字符串连接对 SQL 注入 攻击开放。