参数化查询对SQL注入有何帮助?
txtTagNumber
SqlCommand cmd = new SqlCommand("INSERT INTO dbo.Cars " +"VALUES(@TagNbr);" , conn); cmd.Parameters.Add("@TagNbr", SqlDbType.Int); cmd.Parameters["@TagNbr"].Value = txtTagNumber.Text;
txtTagNumber
int tagnumber = txtTagNumber.Text.ToInt16(); /* EDITED */INSERT into Cars values(tagnumber.Text); /* then is it the same? */
互换的青春