Let's say I have the below code (stripping out useless things like the connection string, dataset creation, setting the command type etc).
string sql = "SELECT * FROM SomeTable WHERE Field=@ParamValue";
using (SqlConnection conn = new SqlConnection())
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(new SqlParameter("ParamValue", someValue));
da.Fill(ds);
}
Is this use of a parameterized query sufficient to ensure security against SQL injection, or do I need to strip quotes from someValue
first, before passing it in as a parameter?