2
I have a query that when running with ADO.NET
it takes less than a second to return your data. When adding Parameters to this query, the return remains the same.
However, when adding a type parameter datetime
, query is not executed, giving timeout error.
The parameter
is being defined according to code below;
var dataInicioparameter = command.CreateParameter();
dataInicioparameter.ParameterName = "@dataInicio";
dataInicioparameter.Value = dataInicio;
dataInicioparameter.DbType = DbType.DateTime;
command.Parameters.Add(dataInicioparameter);
Consultation
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)
@Marconi edition held in the post
– João Paulo Massa
I see no problem with your query. Try to define the type first, before placing the value. What is the input value? The bank does not generate any errors other than timeout?
– Marconi
There is no problem with the query. It is executed if the date parameters are entered hard-coded. Other parameters also work correctly, the problem is when adding the date parameter. And the exception raised is timeout, with no additional information =/
– João Paulo Massa
Did you set the date as well? Because your code is only showing to start.
– DH.
It was defined, removed from the code to not be extended
– João Paulo Massa