I have a query that when executed with ADO.NET
takes less than a second to return your data. When adding parameters to this query, the return remains the same.
However, when adding a parameter of type datetime
, the query does not execute, giving timeout error.
The parameter
is being defined as the code below;
var dataInicioparameter = command.CreateParameter();
dataInicioparameter.ParameterName = "@dataInicio";
dataInicioparameter.Value = dataInicio;
dataInicioparameter.DbType = DbType.DateTime;
command.Parameters.Add(dataInicioparameter);
Inquiry
SELECT * FROM
(SELECT *, ROW_NUMBER() OVER (ORDER BY chave) AS RowNumber1 FROM TabelaX
WHERE DataUltimaAtualizacao >= @dataInicio AND DataUltimaAtualizacao <= @dataFim) AS TabelaY
WHERE RowNumber1 > (@rows * 1000) AND RowNumber1 <= ((@rows * 1000) + 1000)