2
Good afternoon,
In the company’s ERP we have a query in the Index that is limited to 80 records. The problem is that in create we have combos that bring more than 150 records and is also limiting to 80 records.
How can I leave only on index without having to create another method?
private StringBuilder LimitarRetornoLinhas()
{
var sql = new StringBuilder();
sql.Append("SELECT * FROM (" + Environment.NewLine);
sql.Append(_sql.ToString());
sql.Append(" ) WHERE ROWNUM <= 80 ");
return sql;
}
-
public List<Fabricante> Selecionar()
{
var fabricantes = new List<Fabricante>();
_sql.Append(" ORDER BY FAB_NOME ");
StringBuilder sql = LimitarRetornoLinhas();
Conexao conexao = new Conexao();
DataTable dt = new DataTable();
conexao.AbrirConexao();
dt = conexao.ObterDataTable(sql.ToString());
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
fabricantes.Add(Mapear(dt.Rows[i]));
}
}
return fabricantes;
}
because it does not parameterize the method with the desired limit?
– Leandro Angelo