I have an internal method that is called based on another query, it is this way down. I would like to know if this would be a "string.Format" error, if it would be possible to send a SQL injection?
public BuscaProdutosDermaClubeEntity ProdutoDermaClube(string codigoproduto)
{
var strQuery = "";
strQuery += " Usp_Site_BuscaProdutosDermaClub";
strQuery += string.Format(" @codigoproduto = '{0}' ", codigoproduto);
using (contexto = new Contexto())
{
var retornoDataReader = contexto.ExecutaComandoComRetorno(strQuery);
return TransformaReaderEmListaObjetos(retornoDataReader).FirstOrDefault();
}
}
public SqlDataReader ExecutaComandoComRetorno(string strQuery)
{
var cmdComando = new SqlCommand(strQuery, minhaConexao);
return cmdComando.ExecuteReader();
}
In the database the procedure has a variable @codeproduct char (20), if it is an error what is the best correction?